Questions tagged [winsock2]

Windows Sockets 2 (Winsock) enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used

964 questions
4
votes
2 answers

What are the equivalents of IP_RECVOPTS and IP_RECVRETOPTS in Windows

I'm doing some socket programming that I'm trying to make cross-platform compatible. For Windows systems, I'm including the following headers: #include #include When I tried to compile my application on Windows, I got…
Nick Williams
  • 2,864
  • 5
  • 29
  • 43
4
votes
0 answers

How to wait for Windows TCP Network at startup?

I know this should be obvious, but I have found far too many DIFFERENT answers and the ones I've tried all fail (sometimes or all the time), so... We are working on a service and some applications that run at startup on a Windows 10 computer that…
Steve Valliere
  • 1,119
  • 7
  • 12
4
votes
4 answers

Problem using Connect(), send(), recv, with UDP sockets

For my Uni assignment I have to create a fast action paced networked game and so have chosen to use UDP as opposed to TCP. I am aware of a lot of the differences in programming both UDP and TCP and have read through most of the relevant parts of…
Sent1nel
  • 509
  • 1
  • 7
  • 21
4
votes
0 answers

Performance difference between select() vs WSAEventSelect() vs WSAWaitForMultipleEvents()

I have an application that is using a cross platform library developed internally. For various reasons I must stick with using this library under windows at least. That library contains a socket class that I have to use and it's calling select. I…
hookenz
  • 36,432
  • 45
  • 177
  • 286
4
votes
1 answer

WSARecv() and multiple buffers

I would like a precision with WSARecv. Basically it seems you can use the function with an array of WSABUFs. 1- In an overlapped I/O context WITHOUT completion ports, say I use WSARecv() on a datagram socket with an array of 48 WSABUFs, does it…
Yannick
  • 830
  • 7
  • 27
4
votes
5 answers

How to interrupt other std::threads c++

I have a server which is built in a thread-per-client way. Lately, I bumped into a problem that I'm having a really hard time to come up with a solution to, so I thought to ask some help. My server hosts a lobby, in the lobby there are many rooms…
John Wood
  • 43
  • 3
4
votes
2 answers

Winsock RIO: RIOReceive returns immediately with no bytesTransferred

I'm having problems with getting winsock RIO working. It seems that every time I post a RIOReceive it returns immediately with 0 bytes transferred, and my peer can't get a message through. After posting a RIOReceive, I wait on the…
Michael220
  • 193
  • 12
4
votes
3 answers

HTTP in C: Why do I have to call recv() multiple times?

I've started to learn about Network programming in C (sockets), and Internet protocols. Currently I'm focusing on HTTP. During my (very) short experience with implementing HTTP client using C, I discovered that sometimes you have to call recv()…
Programmer
  • 750
  • 2
  • 9
  • 17
4
votes
1 answer

What are socket groups for? (Windows)

How to create and join a socket to a socket group is explain here (WSASocket documentation). http://msdn.microsoft.com/en-us/library/windows/desktop/ms742212(v=vs.85).aspx It's also explained that all sockets in a socket group must connect to the…
Tim Lovell-Smith
  • 15,310
  • 14
  • 76
  • 93
4
votes
1 answer

C++ WinSock2 Errors

Yesterday I've tried to make a socket server in C++, but I get errors upon compiling. The errors: Error 6 error LNK2019: unresolved external symbol _imp_socket@12 referenced in function "public: static unsigned long __cdecl…
4
votes
4 answers

How to check if connection lost

How can I check if my connection with the server lost ? (Client or Server side no matter) I'm using TCP connection, and the server recv unlimit clients. for each client the server create thread. and with that's way I can recv / send for each client.
Ido Hadar
  • 179
  • 3
  • 5
  • 13
4
votes
2 answers

WSAEFAULT error when use getsockname function

I have a problem using getsockname function. I have this code: struct sockaddr sa; int sa_len; sa_len = sizeof(sa); if (getsockname(socketfd, &sa, &sa_len) != SOCKET_ERROR) { /// } else { int error = WSAGetLastError(); //error here…
Breakdown
  • 1,035
  • 4
  • 16
  • 26
4
votes
3 answers

Receiving strange characters/symbols in winsock

Im learning about Winsock and Im having a strange issue when sending and receiving a simple string. Here's my code (pure C): Client: //... //Declarations and stuff //----------- SEND SOME DATA ------------------------------------------------- …
SergiGS
  • 51
  • 1
  • 6
4
votes
2 answers

ws2_32.lib vs. libws2_32.a, what's the difference and how to link libws2_32 to NB project?

I use NetBeans, Windows and Cygwin with g++ compiler. I'm examining Windows Sockets 2. I do everything that is written in MS manual. I have a code (mostly from this manual): #include #include #include #include…
Green
  • 28,742
  • 61
  • 158
  • 247
4
votes
1 answer

Winsock send() always returns error 10057 in server

I'm trying to automate a server request to the client upon connection but I keep getting the WSAGetLastError of 10057. I've set up requests from the client to the server without issues so I don't understand why I cant do the reverse ? Maybe the…
Soran
  • 391
  • 1
  • 4
  • 21