[En-Nut-Discussion] UDP Server Problem

MUHAMMAD AZEEM AZAM muhammadazeemazam786 at yahoo.com
Fri Feb 16 11:49:36 CET 2007


Hi
   
  for(;;)
  {
 
 if ((sock = NutUdpCreateSocket(23)) != 0) 
  
  {
     u_long ip_addr= inet_addr("192.168.5.2");
   u_short port = 2050;
   
   
   NutUdpReceiveFrom (sock,&ip_addr,&port,buff,sizeof(buff),1000);
     NutUdpSendTo(sock,inet_addr("192.168.5.2"),port,"azam",4);
  }
 
 NutUdpDestroySocket(sock);
 
NutSleep(125); 
  }

  The above thing is not working.
  its the simplest
   
  THanks
  
Jose Vicente Sanchez Ortega <jvsanchezo at gmail.com> wrote:
  Hi:

You must implicitly define the address and port since both are input
parameters to NutUdpSendTo and NutUdpReceiveFrom (nobody will fill for you
this fields neither in Receive nor in Send.

Regards,



-----Mensaje original-----
De: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] En nombre de MUHAMMAD AZEEM
AZAM
Enviado el: jueves, 15 de febrero de 2007 18:20
Para: Ethernut User Chat (English)
Asunto: Re: [En-Nut-Discussion] UDP Server Problem

hi

this means when i will call the 
---------------------
NutUdpReceiveFrom() function
its parametrs 
addr will contain address of my client.
and port will contain port of my client.
--------------------------
then i should use NutUdpSendTo() to send my data to the Port and addr that
i have received in NutUdpReceiveFrom() function.
I don't need to implicitly define the address and port.
like that 
unsigned port = 400;
unsigned ip = inet_addr("192.168.0.0");

-------------------------------------------
bye
Jose Vicente Sanchez Ortega wrote:
Hi, MUHAMMAD:

1) UDP is not a stream-oriented protocol (actually is a datagram-oriented
protocol) thus you cannot link an UDP socket with a stream. You must call
the respective functions (i.e. NutUdpReceiveFrom).

2) Yes, you are right.

Bes regards,


Jose Vicente.


-----Mensaje original-----
De: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] En nombre de MUHAMMAD AZEEM
AZAM
Enviado el: jueves, 15 de febrero de 2007 16:38
Para: en-nut-discussion at egnite.de
Asunto: [En-Nut-Discussion] UDP Server Problem

hi
I have to build a UDP Server
But

1) i can't assign stream to udp.
so will the string functions will work or not.
like 
strcpy
strcmp
2) int NutUdpReceiveFrom ( UDPSOCKET * sock, u_long
* addr, u_short * port, void * data, u_short
size, u_long timeout ) 

addr will contain the Ip address of my client(host) and port will contain
port of my client? 



---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion


 
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.


More information about the En-Nut-Discussion mailing list