> Read the help for BeginReceiveFrom()/EndReceiveFrom(). This topic is
> covered specifically there.
[quoted text clipped - 4 lines]
>>itself or if it came over WLAN from a remote machine and what's its IP
>>address...
I don't think that you read the help that I pointed you to. From
BeginReceiveFrom:
-----
This method reads data into the buffer parameter, and captures the remote
host endpoint from which the data is sent. For information on how to
retrieve this endpoint, refer to EndReceiveFrom. This method is most useful
if you intend to asynchronously receive connectionless datagrams from an
unknown host or multiple hosts. In these cases, BeginReceiveFrom will read
the first enqueued datagram received into the local network buffer. If the
datagram you receive is larger than the size of buffer, the BeginReceiveFrom
method will fill buffer with as much of the message as is possible, and
throw a SocketException. If you are using an unreliable protocol, the excess
data will be lost. If you are using a reliable protocol, the excess data
will be retained by the service provider and you can retrieve it by calling
the BeginReceiveFrom method with a large enough buffer.
-----
and from EndReceiveFrom:
-----
To identify the originating host, extract the EndPoint and cast it to an
IPEndPoint. Use the IPEndPoint.Address method to obtain the IP address and
the IPEndPoint.Port method to obtain the port number.
-----
Don't know how to make it any clearer than that...
Paul T.
> Hi Paul,
>
[quoted text clipped - 18 lines]
>>>message itself or if it came over WLAN from a remote machine and what's
>>>its IP address...
Benjamin Lukner - 21 Apr 2006 16:34 GMT
Hi Paul,
> I don't think that you read the help that I pointed you to. From
> BeginReceiveFrom:
[...]
> Don't know how to make it any clearer than that...
You were right, I'd read the help on BeginReceive/EndReceive...
I'd seen before that there is a BeginreceiveFrom function, but I don't
know the sender's IP address and thought the function won't work for my
purposes.
But now I realized that I can pass IPAddress.Any to that function.
Works great, thanks!
Kind regards,
Benjamin Lukner