androidclient-serverandroid-wireless

IO exception client/server socket


I am writing a client/server program to send data over my own local internet wireless network. In the client side, I wrote this snippet

private static final int TCP_SERVER_PORT = 63400
    try {
        // provide a client side TCP socket

        Socket s = new Socket("192.168.1.102", TCP_SERVER_PORT);
            ...

It throws an IOException. I add the INTERNET permission though. I am joining the local DSL internet wifi network. Is it because of the router? Any idea?


Solution

  • Is port 63400 on 192.168.1.102 open?

    try

    telnet 192.168.1.102 63400
    

    if it returns anything then the port is open, and the problem is somewhere else. If it says "name or service unknown" then there is no one listening @ 192.168.1.102:63400

    EDIT: just noticed the android tag. Don't know if u have shell/telnet on android, but you can use this method from PC both windows and linux shell