Re: multiple connect on a socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In UDP land (which I assume you're using - doesn't make sense in TCP,
does it?), I have to set setsockopt( ..., SO_REUSEADDR, ... ) in order
to open a socket more than once.

calling sequence:
socket();
setsockopt(SO_REUSEADDR);
bind( interface ); // bind to group for mcast

I'm not sure if I answered your question.

Nat


On Thu, 2002-08-08 at 12:07, Vasisht Tadigotla wrote:
> 
> Hi,
> 
> i'm doing the following steps,
> 
> 1. open a socket on some remote server
> 2. set it to be non-blocking
> 3. connect to that socket
> 4. do a select on the socket
> 5. read from the socket
> 6. connect to the socket again
> 7. read from the socket
> 
> and as expected a EINPROGRESS error is thrown on step 3. After I do a
> select() and read from that socket, I try to connect to it again and it
> connects without throwing an EISCONN error in linux, though if I try to
> read from it it throws a EAGAIN error. Shouldn't it throw an error when I
> try to connect to it a second time ? Am I missing something here.
> 
> 
> TIA,
> 
> Vasisht
> 
> 
> Please CC as I'm not the list.
> 
> -
> : send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
_________________________________________
Nat Ersoz             Myrio Corporation    -o) 
nat.ersoz@myrio.com   Cell: 425-417-5182   /\\
Phone: 425.897.7278   Fax:  425.897.5600  _\_V
3500 Carillon Point   Kirkland, WA 98033 

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux