send a data to a client

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

send a data to a client

Post by Silvio.Falconi »

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


Image


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 ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: send a data to a client

Post by lucasdebeltran »

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.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: send a data to a client

Post by MarcoBoschi »

Silvio,
did you try sockcli.prg and sockserv.prg in two different computers?
In example in sockserv.prg

Code: Select all

   DEFINE BUTTON OF oBar ACTION oClient:SendData( "Hello from server!" ) TOOLTIP "Talk to client"
works fine!
Marco Boschi
info@marcoboschi.it
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Post by Silvio.Falconi »

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 !!!!!!!!!!!!
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: send a data to a client

Post by Antonio Linares »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Post by Silvio.Falconi »

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 ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply