Can I Use LINUX Socket?

399 views
Skip to first unread message

Nand

unread,
Aug 24, 2010, 12:55:14 AM8/24/10
to android-ndk
Hi,
Can I use LINUX Socket to open a connection? If yes, then are there
any permissions to be set? and how to do the same.

Please help me,

Related post :
http://groups.google.com/group/android-ndk/browse_thread/thread/24f6ce5a2fbe2a71/f736ed26b888b08f?lnk=gst&q=socket#f736ed26b888b08f

Thanks in advance,
Nand

Nand

unread,
Aug 27, 2010, 3:03:32 AM8/27/10
to android-ndk
Hi,
I'm not able to open a socket connection using socket API available in
C library. I'm stuck in accept() method. I'm able to bind the socket
at server but not accept() function is not being called when a client
tries to connect to server.
I have also set the Internet permission in my manifest file.

Please help me.

Regards,
Nand

Christian Linne

unread,
Aug 27, 2010, 4:20:01 AM8/27/10
to andro...@googlegroups.com
If you try to create
(1) your socket (anything g.o.e. 0 is ok),
(2) a connection using it ( "connect(..)"),
what are the return values of the function calls, and what is "errno" afterwards?
 
I've had a similar issue with bluetooth-sockets, which do not work, but I've heard that connections using the network interface should work - haven't tried that yet.
 
Return values may be checked here (for connect) and here (for socket) .

2010/8/27 Nand <nandit...@gmail.com>
Nand

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
_________
Mit freundlichen Grüßen
Yours sincerely

Christian Linne

Mail (private): linn...@aol.com
Mail (official): Christi...@googlemail.com,
ICQ: 293253013

Nand

unread,
Aug 27, 2010, 7:21:41 AM8/27/10
to android-ndk
Hi,
I'm getting an error code no.10060 at client side which i think is for
timed out error.
I'm able to bind the socket at server side but accept() is not called
at server side

Regards,
Nand

Nand

unread,
Aug 27, 2010, 7:22:08 AM8/27/10
to android-ndk

David Turner

unread,
Aug 27, 2010, 8:08:59 AM8/27/10
to andro...@googlegroups.com
are you running the server on the emulator or a device ? If a device, is it on 3g or WiFi.

For the record, 3G connections are usually NAT-ed by cell carriers, so you can't easily connect to a server running on a device anyway.
On WiFi, you should be able to do that, assuming you have the device's IP address (and you're not behind a firewall, etc...)
Finally, in the case of the emulator, you will need to setup a network redirection explicitely to allow your Windows client program to connect to the server inside the guest system. Look at the emulator networking doc for details.


Regards,
Nand

nanditha bg

unread,
Aug 29, 2010, 11:17:14 PM8/29/10
to andro...@googlegroups.com
Hi,
I'm running the server on device using WiFi. I know the ip adress and also able to ping. But not able to connect yo the server

Chris Stratton

unread,
Aug 30, 2010, 11:06:20 PM8/30/10
to android-ndk
You might want to try getting yourself an android build of a great
command line tool called netcat or nc to use for testing. I dont
know if its in the official builds but know its in cyanogen, and would
probably work if you copied the binary out of update.zip from a
comparable android generation to somewhere executable on your device.
It should also build easily from source.

One test you will want to do is using that under the adb shell to
contact your service from inside the phone.

You might also be able to use connectbot or similar app to contact
your server (think of it as telnetting to an unusual port)
Reply all
Reply to author
Forward
0 new messages