Page 1 of 1
send a data to a client
Posted: Thu Apr 26, 2018 11:23 am
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
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 ?
Re: send a data to a client
Posted: Thu Apr 26, 2018 7:08 pm
by lucasdebeltran
Silvio, can you post the code so far?. Thanks
Re: send a data to a client
Posted: Thu Apr 26, 2018 7:22 pm
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
Re: send a data to a client
Posted: Fri Apr 27, 2018 6:28 am
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!
Re: send a data to a client
Posted: Sat Apr 28, 2018 7:41 am
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 !!!!!!!!!!!!
Re: send a data to a client
Posted: Sat Apr 28, 2018 8:37 am
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
Re: send a data to a client
Posted: Sat Apr 28, 2018 10:16 am
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 ?