Home » U++ Library support » U++ MT-multithreading and servers » Need a working simple example of using sockets with GUI in U++
Re: Need a working simple example of using sockets with GUI in U++ [message #40469 is a reply to message #40460] |
Mon, 05 August 2013 23:06 |
Oblivion
Messages: 1094 Registered: August 2007
|
Senior Contributor |
|
|
koldo wrote on Mon, 05 August 2013 10:40 | Hello Lectus
Few weeks ago I began to prepare some functions to communicate different programs in different computers using sockets (in plain words, I am a dummy in sockets ).
Based in U++ Reference/SocketClient and SocketServer it was very simple. It is also very easy to use threads in U++ (just following a couple of simple rules: 1. debug your code before being multithreaded, 2. do not share variables but if you do it, use for example INTERLOCKED), so including in the same program the client and a multi threaded server has been straightforward.
Where are the problems you find?
|
Hello Koldo, I agree Lectus.
IMO, it is generally a better practice to use sockets with threads in a GUI application, but U++ needs a basic single-threaded non-blocking client/server socket example too. While I can use a traditional low level platform dependent socket routines to handle nonblocking socket operations, I have to admit that I find U++ TcpSocket class a bit confusing. A code snippet or a barebone example on, say, how to handle basic nonblocking read()/Get() and write()/put() operations with TcpScoket, and how to cancel or do "other stuff" when socket would block (e.g, canceling the operation) would be really useful.
Regards.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 05 August 2013 23:10] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 15 01:25:44 CEST 2024
Total time taken to generate the page: 0.02941 seconds
|