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 sendandreceive on a


From: Julian Gardner [RSD]
Subject: RE: [lwip-users] Has any work been done on allowing sendandreceive on a single port
Date: Mon, 21 Jan 2008 11:42:32 -0000

Sorry if I have not explained better

What i have is a unit which needs to talk to a master unit on a fixed
port, I open the port as per my code and have a task running which loops
around looking at the read flags until i have some data, once this is
received i process the data and then send back a status block, using
lwip_write!

I have posted my code which currently runs on port 5000, the reason for
the task and code is i may need to monitor a block of ports, 5000-5004



> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On Behalf 
> Of Kieran Mansley
> Sent: 21 January 2008 11:24
> 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".
> 
> 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
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
> 

Attachment: Sct_udp.c
Description: Sct_udp.c


reply via email to

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