FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to re-connect TSocketServer after re-activate server
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to re-connect TSocketServer after re-activate server
Posted: Wed Dec 12, 2007 02:26 AM

Dear All,

I have the problem with TSocket as following.

  1. If I start client before server. It cannot connect and cannot send or receive until re-start the client program (Client must start after Server).

  2. If the server down, client cannot re-connect automatically.

How can I check the connnection and reconnect the server after activate.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to re-connect TSocketServer after re-activate server
Posted: Wed Dec 12, 2007 09:32 AM

Dutch,

Have to tried to redo a: ?

oClientSocket:Connect( <cIPServerAddress> )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to re-connect TSocketServer after re-activate server
Posted: Wed Dec 12, 2007 10:24 AM

Dear Antonio,

You mean if the server down, I have to reconnect by oClientSocket:Connect() command.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to re-connect TSocketServer after re-activate server
Posted: Wed Dec 12, 2007 12:29 PM

Dutch,

Yes, you may need to reconnect again

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to re-connect TSocketServer after re-activate server
Posted: Mon Jun 09, 2008 11:24 AM
Dear Antonio,

I try to use oSocket:connect( cIp) but it doesn't work.

1. When the server is not activate. I don't know.
2. When the server down. I know but when server re-activate. I try to ::connect() but it doesn't know ( ::bConnect is not run ).

- How can I know the server is activate or not?
- How can reconnect if the server re-activate?

Regards,
Dutch

   oSocket := TSocket():New( nPort )
   oSocket:bRead    = { | oSocket | OnRead( oSocket ) }
	
   // Never use a MsgInfo() here because it hangs Windows!!!
   oSocket:bConnect = { || ( lConnect := .T., oWnd:SetText( "Server Connected" )) }

   oSocket:bClose   = { || ( lConnect := .F., oWnd:SetText( "Server Disconnected!" ), oWnd:Refresh(), MsgWait( "Server has closed!",, 5 ) ) }

   oSocket:Connect( cIPAdd ) // use the server IP address here
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: How to re-connect TSocketServer after re-activate server
Posted: Sat May 07, 2011 11:58 AM

Hi dutch,

Have you find the solution?

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06

Continue the discussion