FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour send a data to a client
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
send a data to a client
Posted: Thu Apr 26, 2018 11:23 AM
I finally managed to connect sockserv to the sockcli
and creating an array I saw that when a client connects, it puts the socket number and its ip
as you can see in this picture





Now I wish send a message or a file to client but to a specific client
How I must make ?

I try to send data from server and it send only to the last connected oclient

wich is the command or function to send message to a specific oClient ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: send a data to a client
Posted: Thu Apr 26, 2018 07:08 PM

Silvio, can you post the code so far?. Thanks

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: send a data to a client
Posted: Thu Apr 26, 2018 07:22 PM

I use sockcli.prg and sockserv.prg U found them on samples folder

When a client is connetted to server I create an array with oClient:nSocket and oClient:ClientIP()

I 'am trying to understand How I can acquire information and use the commands of socket

If someone can help me ...

I must not create a netpoint and I not sale my applications I work at school

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: send a data to a client
Posted: Fri Apr 27, 2018 06:28 AM
Silvio,
did you try sockcli.prg and sockserv.prg in two different computers?
In example in sockserv.prg

Code (fw): Select all Collapse
   DEFINE BUTTON OF oBar ACTION oClient:SendData( "Hello from server!" ) TOOLTIP "Talk to client"

works fine!
Marco Boschi
info@marcoboschi.it
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: send a data to a client
Posted: Sat Apr 28, 2018 07:41 AM

yes
SERVER---> Sockserv-prg

one PC----------------------------> Sockcli.prg
Second Pc ----------------------->Sockcli.prg
third Pc -------------------------- >Sockcli.prg

Now I stay on server and send a message ...where I sent the message

only to third Pc...Why ? because only the the server is connected to third pc

oooooooohhhhhhhhhhhh !!!!!!!!!!!!

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: send a data to a client
Posted: Sat Apr 28, 2018 08:37 AM

Silvio,

You need to keep an array with all the clients that you are serving.

In FWH\source\classes\tnewssrv.prg there is an example of a News server that uses sockets and multiple clients :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: send a data to a client
Posted: Sat Apr 28, 2018 10:16 AM

Thanks
I hope to build a chat with socket or understand How I can make
I wish call from server a function to snapshot client screen home I cam make ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion