Posts Tagged ‘network’

Java socket connection timout

March 13th, 2014

There are 2 places to set the timeout option of a socket, at connection and at reading.

  • Socket.connect(SocketAddress endpoint, int timeout) connects this socket to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs. Here the timeout setting only affects the action of connecting!
  • Socket.setSoTimeout(int timeout) enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.

Windows 7 cannot find a specific wireless network

September 18th, 2011

After an accidently reboot of the router, my win 7 laptop could not find this wireless network anymore. I tried to reboot the router and my computer. But either worked. All the other computers (and phones) can find this network and connect to it. And this computer can found other wireless networks and connect to them, but just not this. I also tried adding this network manually, however without luck. Searching on the internet didn’t give me any clue either.

Finally I thought reinstalling the network adapter’s driver might work. So I went to Device Manager, found the adaptoer, and updated the driver software. Bingo! It worked! Thank god, I don’t have to use someone else’s weak unsecured wireless network any more.

command line network tools on linux

July 29th, 2011

netstat

  • netstat -tulpan:
  • netstat -tl
  • netstat -anp –tcp –udp: will show all open tcp and udp connections.

lsof

  • lsof -i
  • lsof -i | grep 80
  • lsof -i | grep apache2

iftop

display bandwidth usage on an interface by host

setting virtualbox networking to allow host & guests communicate

May 21st, 2010

If you use the default  NAT for as your guest machine’s network adaptor, you can access your host from the guests but can’t access the guests from your host. But in the latest version of VirtualBox, it’s very easy to set the networking so that both host and guests can access each other. You only need to set your network adaptor as “bridge” as shown below:

virtualbox-network-bridge