Re: Socket
From: Feroze [msft] (ferozed_at_online.microsoft.com)
Date: 10/07/04
- Next message: Kevin Yu [MSFT]: "RE: Read hyperlink in excel *** in VB.net"
- Previous message: Julian Milano: "How do I change the Product Key?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 6 Oct 2004 18:27:41 -0700
It depends on what protocol you are using. If it is TCP, then you are out of
luck. When you disconnect, TCP detects that the connection was broken. The
socket will go into a disconnected state, and you will have to reconnect
again.
-- feroze ----------------- This posting is provided as-is. It offers no warranties and assigns no rights. See http://weblogs.asp.net/feroze_daud for System.Net related posts. ---------------- "Wally" <valter@nospamcambieri.it> wrote in message news:ZQQ2d.341818$5D1.15260459@news4.tin.it... > 1 Dim bConnectionLost as Boolean > 2 Dim bMsg(10000) As Byte > 3 Dim sPingChar as String=Chr(0) > 4 Do > 5 Try > 6 bMsg = System.Text.Encoding.UTF8.GetBytes(sPingChar.ToCharArray) > 7 pobjSocket.Send(bMsg, bMsg.Length, SocketFlags.None) > 8 bConnectionLost=False > 9 Catch ex As Exception > 10 bConnectionLost = True > 11 End Try > 12 Loop Until Not bConnectionLost > 13 ... > > - When network cable is connected bConnectionLost is set to False, no > exceptions and the flow works fine. > - If I disconnext cable flow loops into DO / LOOP UNTIL of course. > - When I reconnect cable, bConnectionLost doesn't change to False again so > flow doesn't exit from DO / LOOP UNTIL > > > "Supra" <supra56@rogers.com> ha scritto nel messaggio > news:bfH2d.4847$1Ko.4318@news04.bloor.is.net.cable.rogers.com... > > i know how to do this. i used to sent pong to server when server pinged > > me. i used to do irc chat similar to mirc. first u ( as server) must > > send command "PING" to client every 30 second (it is up to u to send > > ping more than 30 seconds). Now on client side when client recived > > PING's command from server ....the client automatically sent command > > "PONG" to server. Now if server don't received command "PONG" from > > client, then server can disconnected to client or close socket for > > client. this is how it works. u will have to write code for urself. > > regards > > > > Wally wrote: > > > > >Hallo > > >Is there anybody able to tell me if and how to restore a lost socket > > >communication? > > >I try to explain. > > >Computer A and computer B are net connected and they estabilished a > socket > > >connection. A (which acts as a server) is waiting for data from B and, > > >while waiting, it sends a "ping" character to B, in order to verify is > the > > >connection is active. > > >Desconnecting the net cable, the "ping" character sending generates an > > >exception, as you can rightly presume that to connetion is no more > active. > > >So far so good. > > >The problem is that re-connecting the net cable, the "ping" character > > >sending generates the same exception, just as if the lost communication > > >couldn't be recuperated unless you do a new call. Any idea or suggestion? > > > > > >Thanks anyhow. > > > > > >VV > > > > > > > > > > > > > > > >
- Next message: Kevin Yu [MSFT]: "RE: Read hyperlink in excel *** in VB.net"
- Previous message: Julian Milano: "How do I change the Product Key?"
- Messages sorted by: [ date ] [ thread ]