From: Anukul Singhal Date: 2009-02-03T11:19:32+09:00 Subject: Re: Socket: Getting EADDRNOTAVAIL in bind method Gary, thanks for your reply. 114.23.42.42 is the address of my device which is not on my local system. My code works fine till I connect to the socket, but after that I need to receive buffer from it, for which I am not able to use the "recvfrom" method. So, I tried to use "bind" method which did not work (since the device is remote but I am able to ping it from my local machine and it is also on the same network). Is it some way I can receive data from the socket after I connect to it? Thanks, Anukul Gary Wright wrote: > On Feb 2, 2009, at 4:50 PM, Anukul Singhal wrote: >> >> In the last method bind, getting the following error: >> >> Test.rb:50:in `bind': The requested address is not valid in its >> context. >> - bind(2) (Errno::EADDRNOTAVAIL) >> >> I think I might be missing something elementary here. If anyone can >> please help with it, would be really grateful. > > > Usually you don't pick the local address to bind to but instead > let the system pick it. Is 114.23.42.42 your local address or is > the address of the device you are trying to connect to? > > If you are trying to bind a local socket to the address of the > remote host/device you'll get EADDRNOTAVAIL since the address > doesn't belong to the local host. > > Gary Wright -- Posted via http://www.ruby-forum.com/.