Re: UDP Client Problem
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Wed, 21 Feb 2007 12:44:18 +0200
If library you use don't return you peer host IP/port that mean that you
have to talk to developers of it. Driver receive data due to Protocol UDP
where have to be both source IP and port. So it have to return it to you
Arkady
"Muhammad Azeem Azam" <MuhammadAzeemAzam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:EDF25A96-0C36-4DBA-AF25-9D541D48D9AF@xxxxxxxxxxxxxxxx
NutUdpReceiveFrom() thats my receive function of Server (Microcontroller).
On return it doesn't automaticaly has the source ip and port (that what i
get from the forum of ethernut but i have conflict with it, i am not
mentioning the client port and ip in my server code but still i am getting
data on my client, this means this function returns the source port and ip
on
return or it Broadcasts? but what can i say).
It asks me for the remote IP and Port.
Its not like windows sockets in MSDN.
Thanks
Bye
"Arkady Frenkel" wrote:
When server received data with WSARecvFrom() it can check 6th parameter (
struct sockaddr* lpFrom ) for that.
If you mean that you have no access to that param, you can bind the port
in
client, but be aware that in such case client will talk only with you
server
( microcontroller ) only on on channel, you'll fail if you need few
channels
to talk
Arkady
"Muhammad Azeem Azam" <MuhammadAzeemAzam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in
message news:681DC3D2-E146-4DBA-8D85-7C8AA6BA3794@xxxxxxxxxxxxxxxx
hi
I know the port of my server an i am sending data successfully.
But my microcontroller (server using some other library to send and
receive), microcontroller wants to know the port an ip of remote host
(means
client), this means i have to bind my client (in UDP) so that
microcontroller
can send data to client.
Actually i am sending request from client (PC) to Server
(Microcontroller)
and in return micocontroller is sending the required data to me.
Thanks for help in advance.
Bye
"Arkady Frenkel" wrote:
No, client have to know server's port and send to data to it, OTOH
server
can check that when recvfrom() returned successfully
Arkady
"Muhammad Azeem Azam" <MuhammadAzeemAzam@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote
in
message news:0DEFA80C-16D3-49EC-8DDC-014C83E61039@xxxxxxxxxxxxxxxx
Hi
the problem is my server need to know the port of my client (that
shold
be
permanant?)
How can i know my port(getsockname() ?).
But i think i need to fix my port.
thanks
"Arkady Frenkel" wrote:
No, you don't need to bind client client both in UDP and TCP
Arkady
"Muhammad Azeem Azam" <MuhammadAzeemAzam@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote
in
message news:CBB58DCB-5207-40AF-9740-8516FCB68223@xxxxxxxxxxxxxxxx
Hi
I have to made a UDP client.
Do i ned to bind it or not.
My Server has following function for dending data to client
----------------------------
int NutUdpReceiveFrom ( UDPSOCKET * sock,
u_long * addr,
u_short * port,
void * data,
u_short size,
u_long timeout
)
Receive a UDP datagram.
Parameters:
sock Socket descriptor. This pointer must have been retrieved by
calling
NutUdpCreateSocket().
addr - IP address of the remote host in network byte order.
port - Remote port number in host byte order.
data - Pointer to the buffer that receives the data.
size - Size of the buffer that receives the data.
timeout - Maximum number of milliseconds to wait.
-------------------
But problem is its asking for the remote host IP Address and
Port.
This menas i have to bind my client to specific port.
Am i right?
Thanks for help in advance
BYe
.
- References:
- Re: UDP Client Problem
- From: Arkady Frenkel
- Re: UDP Client Problem
- From: Arkady Frenkel
- Re: UDP Client Problem
- From: Muhammad Azeem Azam
- Re: UDP Client Problem
- From: Arkady Frenkel
- Re: UDP Client Problem
- From: Muhammad Azeem Azam
- Re: UDP Client Problem
- Prev by Date: Re: How to establish Wireless Communication
- Next by Date: Re: broadcast with unbound adapter
- Previous by thread: Re: UDP Client Problem
- Next by thread: Re: How to get Noise Floor value using WLAN API
- Index(es):
Relevant Pages
|