Hi friend,
About socket programming, I used to do with UDP and TCP.
With UDP, server must have one socket to communicate, it looks like:
while(1)
{
int bytes_read = recvfrom(sd, buffer, sizeof(buffer), 0, 0, 0);
}
You can find out it on internet, so much example for it.
With TCP, server must have one socket to communicate, and you should find out what is "listen", and "accept" functions.
With both, you need to know multi-thread, may be POSIX thread or Win32 thread, depend on your OS which you do on.
With them( UDP/TCP, thread) you can create a simple client-server.
If you want to be good about socket programming, the first do no care about Qt thread, Java thread, C# thread. Let's start with APIs of OS to create thread as: pthread_create ( UNIX-Like), CreateThread( Win32).
Good luck!




Reply With Quote



Bookmarks