Dear doc-zee,
I’v done this some years before. I’ll post it here for you. Once I’m brazilian the coments are in portugese, but if you need a better explanation in some item, just write me back. I now that I’ve already answerd this kind of question before, so if you search in the forum you may find my previous posts.
Regarding to the string size limitation, that’s a fact. Strings are 80 chars log limited. What can be done to avoid this is sending data by a rawbytes pack. Rawbytes can be 1024 bytes long.
So, here is the code:
!=========================================================================
PROC OpenTCPServerConnection()
! DescriA?A?o: Implementa uma conexA?o via TCP.
! Entradas: Nenhuma
! SaA-das: Nenhuma
! AlteraA?A?es: Tela do TP
!*************************************************************************
! Fecha eventuas conexA?es abertas
SocketClose Server_Socket;
SocketClose Client_Socket;
!Cria o socket serivor
SocketCreate Server_Socket;
SocketBind Server_Socket, server_ip, TCP_Port;
! Escuta e aguarda conexA?o do cliente
TPErase;
TPWrite “Aguardando conexA?o no endereA?o: " + server_ip +”, porta: " Num := TCP_Port;
SocketListen Server_Socket;
SocketAccept Server_Socket, Client_Socket ClientAddress := client_ip;
TPWrite "Conectado com sucesso a " + client_ip;
ENDPROC
!=========================================================================
!=========================================================================
PROC OpenDebugServerConnection()
! DescriA?A?o: Implementa uma conexA?o via TCP.
! Entradas: Nenhuma
! SaA-das: Nenhuma
! AlteraA?A?es: Tela do TP
!*************************************************************************
! Fecha eventuas conexA?es abertas
SocketClose ServerDebug_Socket;
SocketClose ClientDebug_Socket;
!Cria o socket serivor
SocketCreate ServerDebug_Socket;
SocketBind ServerDebug_Socket, server_ip, Debug_Port;
! Escuta e aguarda conexA?o do cliente
TPWrite “Aguardando conexA?o de depuraA?A?o no endereA?o: " + server_ip +”, porta: " Num := Debug_Port;
SocketListen ServerDebug_Socket;
SocketAccept ServerDebug_Socket, ClientDebug_Socket ClientAddress := client_ip;
TPWrite "Conectado com sucesso a " + client_ip;
ENDPROC
!=========================================================================
!=========================================================================
PROC OpenTCPClientConnection()
! DescriA?A?o: Implementa uma conexA?o via TCP.
! Entradas: Nenhuma
! SaA-das: Nenhuma
! AlteraA?A?es: Tela do TP
!*************************************************************************
! Fecha eventuas conexA?es abertas
SocketClose Client_Socket;
!Cria o socket serivor
SocketCreate Client_Socket;
TPErase;
TPWrite "Aguardando conexA?o no endereA?o: 192.168.125.2, porta: " Num := TCP_Port;
SocketConnect Client_Socket, “192.168.125.2”, TCP_Port;
ENDPROC
!=========================================================================
!=========================================================================
PROC OpenDebugClientConnection()
! DescriA?A?o: Implementa uma conexA?o via TCP.
! Entradas: Nenhuma
! SaA-das: Nenhuma
! AlteraA?A?es: Tela do TP
!*************************************************************************
! Fecha eventuas conexA?es abertas
SocketClose ClientDebug_Socket;
!Cria o socket serivor
SocketCreate ClientDebug_Socket;
TPWrite "Aguardando conexA?o de depuraA?A?o no endereA?o: 192.168.125.2, porta: " Num := Debug_Port;
SocketConnect ClientDebug_Socket, “192.168.125.2”, 1026;
ENDPROC
!=========================================================================