Hello, Please check the Error argumend in the OnSessionConnected and also in the OnSessionClosed. Both can tell you if the failure comes from somewhere in the network.
You can also use SocketSpy (user made page) to see who disconnect if there is no error. I'm not sure if Socketspy log this, but it is very easy to add if it is not. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Wednesday, August 16, 2006, 09:43, S S wrote: > Hi, > I added an event onSessionClosed.Now my client fires this event > after sending the second command to create notification channel.and > shows the message client disconnected.My question is why does my > client gets disconnected after sending the second command.Please > suggest where am i wrong? > procedure TCAENForm.CAENClientSocketSessionClosed(Sender: TObject; > ErrCode: Word); > begin > Display('Client Disconnected'); > end; > procedure TCAENForm.ExecuteCommand; > begin > //Commands Send to CAEN Reader for creating notification channel. > SendCommand(@CreateNotfTrgCmd,55); > SendCommand(@CreateReadTrgCmd,54);//gets disconnected after > sending this command and fires onsessionClosed event > SendCommand(@CreateNotfChnCmd,69); > SendCommand(@AddSrcNotfChnCmd,53); > SendCommand(@AddNotfTrgNotfChnCmd,59); > SendCommand(@AddReadTrgSrcCmd,52); > end; > Thanks, > Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: > Hello, > If the client comes into the state wsConecting then after a while some > event should fire. It can be the OnSessionConnected with or without a > winsock error or the onSessionClosed with or without a winsock error. > Please check both. Whith that information we could help more I think. > --- > Rgds, Wilfried [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > http://www.mestdagh.biz > Monday, August 14, 2006, 15:56, S S wrote: >> Hi, >> No, the client does not generate any winsock error.It just gets disconnected >> and even if I try connecting it again after the second send >> command to create notification channel it shows its state as >> wsconnecting and does not connect >> No clue where am i going wrong??? >> Wilfried Mestdagh wrote: >> Hello, >> When the client close, does is generate a winsock error ? Same question >> for the datasocket at server side? >> --- >> Rgds, Wilfried [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> http://www.mestdagh.biz >> Monday, August 14, 2006, 11:38, S S wrote: >>> Hello Everyone, >>> I have two units - >>> 1)CAENUnit >>> 2)MainUnit >>> There is a button "Start Server" in my main unit which when >>> clicked starts my server,starts my client,thereby on session connected >>> event the client sends commands to the reader to create notification >>> channel ,receives reply on data available event and then the server >>> starts receiving data from the reader >>> To stop,we click on "Stop server" button in main unit which in >>> turn stops the server and the client. >>> My program works fine till this point.But when I restart i.e., click on >>> start server again >>> the server connects,client connects but the client disconnects >>> after some time after sending the second command. >>> The section of main unit which calles CAEN unit is as follows >>> procedure TMainForm.StartButtonClick(Sender: TObject); >>> begin >>> if StartButton.ImageIndex = 0 then begin >>> // Starting a connection with a Reader >>> try >>> if ReaderComboBox.Text = 'Symbol' then begin >>> SymbolForm.ClearWorkArea; >>> SymbolForm.HttpServer.Start; >>> SymbolForm.ServerRunning := True; >>> end else if ReaderComboBox.Text = 'CAEN' then begin >>> CAENForm.ClearWorkArea; >>> CAENForm.StartTCPServer; >>> CAENForm.Connect; >>> CAENForm.ServerRunning := True; >>> end; >>> TestButton.Visible := True; >>> ReaderComboBox.Enabled := False; >>> DatabaseRepairMenu.Enabled := False; >>> except >>> SkinMessage.MessageDlg('Server could not be started. Please, >>> check IP and Port.',mtError,[mbOk],0); >>> exit; >>> end; >>> StartButton.ImageIndex := 1; >>> StartButton.Caption := 'Stop Server'; >>> end else begin >>> try >>> if ReaderComboBox.Text = 'Symbol' then begin >>> SymbolForm.HttpServer.Stop; >>> SymbolForm.ServerRunning := False; >>> end else if ReaderComboBox.Text = 'CAEN' then begin >>> CAENForm.StopTCPServer; >>> CAENForm.Close; >>> CAENForm.ServerRunning := False; >>> end; >>> TestButton.Visible := False; >>> TestButton.ImageIndex := 3; >>> TestButton.Caption := 'Start Testing'; >>> ReaderComboBox.Enabled := True; >>> DatabaseRepairMenu.Enabled := True; >>> except >>> SkinMessage.MessageDlg('Server could not be stopped.',mtError,[mbOk],0); >>> exit; >>> end; >>> StartButton.ImageIndex := 0; >>> StartButton.Caption := 'Start Server'; >>> end; >>> end; >>> I am attaching the code of CAEN unit. >>> Please suggest why does my client socket get disconnected after >>> sending the second command .i have no clue about it... >>> Please help. >>> Thanks >>> --------------------------------- >>> Do you Yahoo!? >>> Next-gen email? Have it all with the all-new Yahoo! Mail Beta. >>> --------------------------------- >>> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and >>> 30+ countries) for 2ยข/min or less. >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://www.elists.org/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be >> --------------------------------- >> Stay in the know. Pulse on the new Yahoo.com. Check it out. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be