2,318 questions
1
vote
1
answer
97
views
winsock: Can an OVERLAPPED to WSARecv be freed immediately after calling CancelIoEx vs after waiting for completion?
So I am working with a windows IO Completion Port to implement some sort of IO event loop that keeps track of IO operations in a client/server model.
I am heap allocating data for each IO operation, ...
0
votes
1
answer
92
views
WSAEWOULDBLOCK and subsequent select returns 0
I am initially getting a WSAEWOULDBLOCK from a call to connect(). Afterwards I do a select that socket included (waiting for process to complete ) and still get a zero
Here is my code:
return_code = ...
0
votes
0
answers
78
views
Get process name from client socket [duplicate]
I have a TCP server that can accept connections and send a response. When a client connects to the server from the computer where the server is running, I need to know the name of the process from ...
2
votes
1
answer
80
views
Does connect() ever fail with WSAEWOULDBLOCK for UDP (SOCK_DGRAM) sockets?
When using Winsock with TCP connections (SOCK_STREAM, connection-oriented), calling WSAAsyncSelect puts the socket into non-blocking mode. A call to connect at that point will generally return with ...
0
votes
1
answer
55
views
Detecting Zero Window State in Windows IOCP Server
I’m developing a Windows IOCP server and need to accurately detect when a client enters a zero window state. Specifically, I want to understand how the server can identify this condition when ...
0
votes
0
answers
54
views
Disconnect Reconnect of winsock2 socket causes application to hang?
I have a winsock2 client/server application that hangs when a client that has already connected to the server on one computer tries to connect to the server again from another computer. The logic in ...
0
votes
0
answers
46
views
Winsock sockets requests per second processing?
I'm trying to find out how many requests per second to allow to our old Winsock 2.2 server. Currently, it's on a dev server with an i5 4 core CPU. I have it set up to run 2 threads per processor so 8 ...
1
vote
0
answers
67
views
What are the parameters in the "SOCKET" struct in the winsock API?
I came across the usage of select(...,fd_set,...) in winsock to check on multiple sockets at once without blocking the application. But it needs the input fd_set.
this is what fd_set looks like:
https:...
0
votes
1
answer
100
views
The function in the thread does not output the value correctly
The function SentMessage always outputs 100, even if the value has changed. I tried to create pointers, pass p1 in different ways, but it always output 100. How can I read p1 in thread?
Hero p1 = { &...
0
votes
0
answers
75
views
C++ Winsock and Qt threading
The execution of the server code reaches the accept() function, and the GUI thread takes control, it is very important to me that the acceptSocket is structured because by calling SendMessage() ...
0
votes
0
answers
65
views
QTcpServer stop accepting new connections
I'm caught by a strange problem.
A listening QTcpServer that is working normally suddenly stops accepting new connections (qBittorrent webui stop working).
I did a little digging into Qt's source and ...
1
vote
1
answer
142
views
Unresolved external symbols in <wsk.h> while building [duplicate]
I try to Winsock kernel and write a test project that set up the wsk environment, but the error occured while building project the visual studio can not link the definitions of wsk functions.
I ...
1
vote
0
answers
118
views
windows 10 network cable unplugged event removes TCP connection
kind people.
My computer has multiple network interfaces( Intel I210) and runs Windows 10. I use TCPView to monitor the TCP connections established between Putty SSH client and Linux during the ...
1
vote
2
answers
275
views
Invalid IP address with InetPton() function
I am using the Windows OS and am coding in C, currently.
I am a complete beginner in socket programming, and have this following piece of code that is returning unwanted values.
(MAXLINE = 4096), and ...
0
votes
1
answer
78
views
C pointers in Windows sockets
I'm starting with sockets on Windows in C, and I'm trying to understand the use of pointers in C and get a clear idea of why some variables are pointers.
In this code:
int sock;
struct sockaddr_in ...
0
votes
0
answers
40
views
When using AcceptEx and lpfnAcceptEx equally, only lpfnAcceptEx throws an error
In the AcceptEx part of the code, the address information is written to the buffer normally, but when I check the lpfnAcceptEx part by calling GetAcceptExSockaddrs later, the local and remote ...
0
votes
1
answer
115
views
TCP client does not detect server disconnection
I have a .Net TCP client which connects to Telnet server (currently, for testing, via localhost):
tcpClient.ReceiveTimeout = 300;
tcpClient.SendTimeout = 300;
tcpClient.NoDelay = true;
LingerOption ...
0
votes
0
answers
205
views
What is the point of specifying SOCK_STREAM and IPPROTO_TCP in getaddrinfo if both refer to a TCP connection?
I'm revisiting winsock after all these years with fresh eyes and can't seem to understand why SOCK_STREAM and IPPROTO_TCP are both necessary to specify in the pHints parameter of getaddrinfo:
INT ...
1
vote
1
answer
107
views
Winsock2: Using connect() to connect to server, but from tcp port < 1024?
Does Winsock2 have an API to define which TCP port a client uses to connect() to a server?
We need to connect() to a UNIX server, which only responds if the client TCP port is < 1024 (Reserved ...
0
votes
0
answers
142
views
Which data types should be used for Bytes sent in C++ socket/network programming?
I wonder which data type is the most suitable for representing bytes I send via Windows API winsock.
I'm currently working on receiving and sending data frames on network sockets, as well as a CAN ...
0
votes
0
answers
100
views
Problem creating the qname of a DNS query in C
I have been trying to create a DNS query in C but I am having trouble managing different data types and pointers,
I have the header build in the first position of a variable called buf. Now I want to ...
0
votes
0
answers
156
views
Why WSAEACCESS when re-opening UDP socket?
My program needs to be able to close and later re-open a UDP socket to receive data. The socket will always be using the same port and INADDR_ANY.
When I try to re-open the socket, I am always ...
0
votes
0
answers
331
views
Increasing buffer size in setsockopt not reflected during runtime in WIndows
I've been trying to increase the size of the socket buffers (specifically the receive side buffers for UDP packets) using the winsock2 setsockopt function as such:
u_long iMode(1);
handle = socket(...
0
votes
0
answers
55
views
My image comes out broken from tcp sending
I'm a beginner in C++, and I'm building a program to transfer files and images. I have a simple code to send pictures over TCP taken from Sending Picture via TCP. But my images came broken, with ...
1
vote
0
answers
106
views
C++ WinSock: How to know if receiver disconnected
I have two programs. They are connected via TCP, localhost, and running on the same machine. First is sending a message via send(), and second is receiving via recv(). When second program is ...