send a data to a client

send a data to a client

Postby Silvio.Falconi » 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


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 ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Postby lucasdebeltran » Thu Apr 26, 2018 7: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.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: send a data to a client

Postby Silvio.Falconi » Thu Apr 26, 2018 7: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Postby MarcoBoschi » Fri Apr 27, 2018 6:28 am

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

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

works fine!
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: send a data to a client

Postby Silvio.Falconi » Sat Apr 28, 2018 7: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: send a data to a client

Postby Antonio Linares » Sat Apr 28, 2018 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: send a data to a client

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests