I found TooTallNate's Java-Websocket library. I am attempting to implement a client and server as a proof of concept to see if web sockets will solve a problem for us.
My client is my Ubuntu 12.04 Linux workstation. I wrote a websocket server application that listens for bindings on 4242. Then I run my client and attempt to connect. I captured the communication using wireshark:
214 9.064163 192.168.1.81 192.168.20.50 TCP 74 43413 > 4242 [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=185839 TSecr=0 WS=128
215 9.064191 192.168.20.50 192.168.1.81 TCP 54 4242 > 43413 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
My question is, why would the packet be refused so quickly? I don't believe I'm running a firewall, but if it were a firewall, unregistered ports generally just get ignored instead of shutdown within a few picoseconds. Does anyone know what this means?
You should first of all check whether the server is actually listening, using netstat:
netstat -ln
or, using the long form parameters
netstat --listening --numeric
If you don't see anything listing on the correct port, something went wrong during setup on the server side.