System.Net.Sockets.SocketException -UDP
- From: "Torben Schulz" <grimwulf[ENTF]@gmx.net>
- Date: Tue, 4 Oct 2005 14:24:47 +0200
Hallo Forum,
ich sende ein UDP-Protocol und warte auf eine Antwort (die laut
Netzwerksniffer auch gesendet wird).
Hier mein Code zum Empfangen, das ganze läuft als Thread:
private void ListenerThread()
{
UdpClient udp_listener = new UdpClient();
try
{
IPEndPoint receiveEndPoint = new IPEndPoint(IPAddress.Any ,0);
Byte[] receiveBytes;
string returnData = String.Empty ;
// while (returnData == String.Empty )
// {
receiveBytes = udp_listener.Receive( ref receiveEndPoint ); //Hier kommt
ein Fehler!
returnData = Encoding.ASCII.GetString(receiveBytes);
Console.WriteLine("This is the message you received " +
returnData.ToString());
// }
}
catch ( System.Net.Sockets.SocketException ex )
{
Console.WriteLine( ex.ToString());
}
finally
{
udp_listener.Close();
}
}
}
In dieser Zeile:
receiveBytes = udp_listener.Receive( ref receiveEndPoint );
kommt immer ein Fehler:
"System.Net.Sockets.SocketException: Ein ungültiges Argument wurde
angegeben"
Das verstehe ich nicht, ist mein Vorgehen doch großteils aus der MSDN
Weiß jemand Rat?
Viele Grüße,
Torben Schulz
.
- Follow-Ups:
- Re: System.Net.Sockets.SocketException -UDP
- From: Thomas Scheidegger [MVP]
- Re: System.Net.Sockets.SocketException -UDP
- Prev by Date: Re: File.Copy(...) auf Netzwerkpfad
- Next by Date: Re: Daten von TreeView in Tabelle
- Previous by thread: File.Copy(...) auf Netzwerkpfad
- Next by thread: Re: System.Net.Sockets.SocketException -UDP
- Index(es):
Relevant Pages
|