lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Has any work been done on allowing send andreceive on a


From: Kieran Mansley
Subject: RE: [lwip-users] Has any work been done on allowing send andreceive on a single port
Date: Mon, 21 Jan 2008 11:24:11 +0000

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".

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]