facing problem in binding
-
@ManiRon Why don't you use http://doc.qt.io/qt-5/qtnetwork-index.html ? Then your question would be related to Qt.
And you don't even mention what problem you face... -
@jsulm my problem is when i try to bind data it returns an error saying the bind failed: invalid argument
-
@ManiRon Are you aware that your question is completely unrelated to Qt?
You're using low level socket API not Qt.
Please post at least the whole compiler error. -
@ManiRon So, it's not a compiler error but a runtime error.
You should zero your address first likebzero((char *) &address, sizeof(address));
As shown here http://www.cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html
-
@ManiRon So, it's not a compiler error but a runtime error.
You should zero your address first likebzero((char *) &address, sizeof(address));
As shown here http://www.cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html
-
@jsulm said in facing problem in binding:
bzero((char *) &address, sizeof(address));
I used memset(&address, 0, sizeof(sockaddr_in)); this and set it to zero but still the problem exists
-
@ManiRon Are you sure you want to use SOCK_DGRAM (UDP) and not SOCK_STREAM (TCP)?
If I remember correctly you don't need bind() for UDP. -
@ManiRon Are you sure you want to use SOCK_DGRAM (UDP) and not SOCK_STREAM (TCP)?
If I remember correctly you don't need bind() for UDP.