Sockets (Client/Server)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Sockets (Client/Server)

Gtkmm mailing list
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.

--
Mohamed Khalil BOUJDARIA
Élève ingénieur en mécatronique
École nationale d'ingénieurs de Carthage
Tél : +21653283365/+21652054010

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

Gtkmm mailing list

TCP communication is handled by Gio::Socket in glibmm. There is an example at
https://gitlab.gnome.org/GNOME/glibmm/tree/glibmm-2-58/examples/network
but it does not include windows.

Gtk::Socket is another kind it socket. It has nothing to do with TCP or UDP.

/Kjell

On 2019-02-26 21:44, Mohamed Khalil BOUJDARIA via gtkmm-list 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.

--
Mohamed Khalil BOUJDARIA
Élève ingénieur en mécatronique
École nationale d'ingénieurs de Carthage
Tél : +21653283365/+21652054010


_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

Gtkmm mailing list
I'd also point out that Gtk::Socket and ::Plug are deprecated in GTK 3 and removed in GTK 4, so probably no one should start writing new code with them, unless completely unavoidable. X11 programs poking at each other's windows and whatnot is not a future-proof way to do things, hence the removal.


_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

aitor_czr
In reply to this post by Gtkmm mailing list

Hi Mohamed,

On 27/2/19 13:00, [hidden email] 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.



_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

aitor_czr
In reply to this post by Gtkmm mailing list
On 28/2/19 13:00, aitor_czr [hidden email] wrote:
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.

*a few days*

:)


_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

aitor_czr
In reply to this post by Gtkmm mailing list
Hi,
On 28/2/19, Mohamed Khalil BOUJDARIA [hidden email] wrote:
Hi Mohamed,

On 27/2/19 13:00, [hidden email] 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.




_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Sockets (Client/Server)

aitor_czr

Hi again,

On 1/3/19 8:12, aitor_czr wrote:

Build  the client and the server in a secondary plane:

$ ./server &

and then run the client as often as you wish:

$ ./client

Build the client and server:


$ gcc client.c -o client

$ gcc server.c -o server

and run the server in a secondary plane:

$ ./server &

after that, run the client:

$ ./client

I meant.

Aitor.




_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list