Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

QTcpSocket questions

$
0
0
I’ve got a rather large assignment I’m trying to get started on. Basically, the easiest way to describe it is that I have to design and code an Instant Message solution. My professor wants both the client and server side programs and wants me to use the TCP protocol and a GUI. I decided to use Qt because the easiness of its GUIs and it’s network support. However, in designing the server side program, I’m running into an issue with QTcpSocket. I can’t figure out the right way to do it. How do I designate a port to listen on? How do I send new data back to the client? Do I need one socket to receive and one one to send? As of now, I have a class to handle the sending and receiving, sending and connection management. For opening the port to receiving, I used Socket->bind(8060); Now, I have no idea if that’s the correct syntax to listen on that port. To send, do I have to have a new socket and connect to the client? Would I have to do something like socket2->connectToHost("destIP",destPort); and socket2->write(data); The Qt framework is really new to me and I’ve just recently decided to start experimenting with it. I have to kind of take the crash course on the networking portion to get this done and I really appreciate any help in making this work. Sean

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>