> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Kieran Mansley > Sent: Monday, January 21, 2008 3:24 AM > To: Mailing list for lwIP users > Subject: RE: [lwip-users] Has any work been done on allowing > sendandreceive on a single port > > On Mon, 2008-01-21 at 11:11 +0000, Julian Gardner [RSD] wrote: > > Ive done > > > > sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP); > > > > memset( ( void * )&sockAddr, 0, sizeof( struct sockaddr_in ) ); > > sockAddr.sin_family = AF_INET; > > sockAddr.sin_addr.s_addr = INADDR_ANY; > > sockAddr.sin_port = port; > > if( bind( sock, ( struct sockaddr * )&sockAddr, sizeof( sockAddr ) ) > > !=0) > > { > > } > > > > Now do i need to do anything else to make this bi-directional?. > > I'm still not clear what you're trying to achieve. > > All sockets are by default one-to-one and bi-directional. > > If you just need to do bi-directional communication between two > computers (A sends to B, B sends back to A), you should get that with no > trouble at all with a normal socket. > > If you want three computers (i.e. A sends to B, and B sends to C) then B > will need two sockets. It can't use one socket for both receiving from > A and sending to C as sockets are normally just one-to-one. Both those > sockets can be on the same address and port at B (I think) though. You > may have to be a bit careful about how you bind them to ensure they > don't "overlap".
[TT] I had problems when a customer bound 2 UDP sockets to the same local port and address. Leon had put in some code to handle it, but it was #ifdef'd out, and would cause the tcpip thread to lock up for me. It's been a couple weeks, but apparently the bsd-way to handle this is to allow two sockets to bind to the same port so long as the local address is different. I was going to work on it, but am busy elsewhere, so use caution when binding to the same port. > > You may, if that doesn't fulfill your needs, be able to do something > with multicast (as then the socket isn't just one-to-one) but that's a > whole different kettle of fish. > > Kieran > > > > _______________________________________________ > lwip-users mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
