android - How to get ip of sender in TCP in Java? -


how ip of sender in tcp communication in android.

any 1 have idea?

in order receive tcp communication in android, you'll need have done this:

    serversocket serversocket = new serversocket(port);     socket clientsocket = serversocket.accept(); 

you can address of client it's socket by

    inetaddress clientaddress = clientsocket.getinetaddress() 

to in text form, can use

    string clientaddressstring = clientaddress.gethostaddress() 

of course of these things can throw exceptions, you'll need handle them.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -