Re: Sockets (Client/Server)



Hi,
On 28/2/19, Mohamed Khalil BOUJDARIA <khalil boujdaria gmail com> wrote:
Hi Mohamed,

On 27/2/19 13:00, gtkmm-list-request gnome org wrote:
Hello,

Can someone please provide me with a simple example of a Sockets (TCP)
connection between two windows using gtkmm. I would like to also ask if the
gtk.Socket allows TCP connection ?

Thanks.
I'm using connections between two different processes (the frontend and 
the backend) in one of my gtkmm projects (simple-netaid):

https://git.devuan.org/aitor_czr/simple-netaid-gtk

Give me a few of days (i'm a bit busy now), and i'll try to put here a 
simple example about how to approach this issue.

Interesting thread, btw :)

Cheers,

Aitor.


Here you are an example of an unix socket:

http://gnuinos.org/examples/socket/

Build  the client and the server in a secondary plane:

$ ./server &

and then run the client as often as you wish:

$ ./client

and you'll get two messages each time, as follows:


aitor@aitor-Latitude-D430:~/Desktop/0-SOCKETS/SOCKET$ ./server &
[1] 2993
aitor@aitor-Latitude-D430:~/Desktop/0-SOCKETS/SOCKET$ ./client
This is the first message
This is the second message
aitor@aitor-Latitude-D430:~/Desktop/0-SOCKETS/SOCKET$ ./client
This is the first message
This is the second message
aitor@aitor-Latitude-D430:~/Desktop/0-SOCKETS/SOCKET$ pkill server
[1]+  Terminado               ./server
aitor@aitor-Latitude-D430:~/Desktop/0-SOCKETS/SOCKET$


@mohamed: you can use this method for the connection between those gtkmm widgets.

I'll share another example shortly using a fifo instead (but similar concept: a file descriptor).

HTH,

Aitor.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]