[Top][All Lists]
[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: |
Frédéric BERNON |
Subject: |
RE : [lwip-users] Has any work been done on allowing sendandreceive on a single port |
Date: |
Mon, 21 Jan 2008 12:30:22 +0100 |
Can I suggest to try with these little changes ?
> sock = socket( AF_INET, SOCK_DGRAM, 0);
>
> memset( ( void * )&sockAddr, 0, sizeof( struct sockaddr_in ) );
> sockAddr.sin_family = AF_INET;
> sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
> sockAddr.sin_port = htons(port);
> if( bind( sock, ( struct sockaddr * )&sockAddr, sizeof( sockAddr )
> )
> !=0)
> {
> }
>
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : address@hidden
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Kieran Mansley
Envoyé : lundi 21 janvier 2008 12:24
À : Mailing list for lwIP users
Objet : 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
Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE : [lwip-users] Has any work been done on allowing sendandreceive on a single port,
Frédéric BERNON <=