The UDP packets don't have a timeout, because the UDP protocol isn't connection oriented. There's an UDP implementation of UDP in a TCP channel, where the connection is established, and you send the messages over the channel established.
You must implement the notification in the server side. An establish your own timer with the timeout and wait for the response from the server side. -----Mensaje original----- De: dotnet discussion [mailto:[EMAIL PROTECTED]] En nombre de dave wanta Enviado el: lunes, 13 de mayo de 2002 4:43 Para: [EMAIL PROTECTED] Asunto: [DOTNET] Timeout on UDP Packet Hi all, I'm writing a UDP program and I'd like to have the socket time out if it doesn't recieve an answer in n milliseconds. What I do is send a packet to a UDP server, which is fine, everything works ok... but then I want to wait n milliseconds for a reply, and if I don't get a reply then handle accordingly. However, with my current code, my code hangs if I don't get a reply back from the server. Does anyone know what I need to change? Here is my code... //sending the packet, works great! byte[] PacketToSend = BuildPacket(); IPAddress address = Dns.Resolve( serverAddress ).AddressList[0]; Socket s = new Socket( AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp); s.SendTo( PacketToSend, 0, PacketToSend.Length, SocketFlags.None, new IPEndPoint( address, _Port ) ); //works great if the packet comes back, but //hangs up if the response packet is never rec'd m_UdpPacket = new Byte[ m_Length ]; IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint tempRemoteEP = (EndPoint)sender; s.ReceiveFrom( m_UdpPacket, 0, m_Length , SocketFlags.None, ref tempRemoteEP ); Thanks in advance, Dave You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.