2,318 questions
1
vote
1
answer
103
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
65
views
System (PID 4) listens on my port after I close the listening socket
On Windows Server 2022 I'm running a custom HTTPS server (part of a larger app). The service binds, listens and then accepts on port 81 for a while and netstat -abn shows:
TCP 0.0.0.0:81 ...
0
votes
1
answer
93
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
33
views
How to automatically determine source IP for raw UDP packets? [duplicate]
i want to send data via UDP raw sockets with Winsock.
I already implemented that and it is working fine, however, at the moment, i'm using a hard-coded source IP, which is the local IP of my WiFi ...
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 ...
1
vote
1
answer
93
views
Winsocket UDP : works only when wireshark launched
I have FPGA device which is waiting for UDP packet "FFFF" on port 1000, then answers also with UDP "FFFF".
This code works fine, I see incoming "FFFF" packets on my JTAG, ...
2
votes
1
answer
88
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
285
views
Why is my call to GetOverlappedResult hanging after cancelling an accept operation?
I have a thread which repeatedly calls AcceptEx on a listening port until it's told to exit, at which point it attempts to cancel the last initiated accept.
Note: To clarify, the TASSERT & ...
0
votes
1
answer
62
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
154
views
using winsock to connect over the internet (IPv6)
I am working on a video game and for it I am trying to add online multiplayer. I created my own winsock wrapper file to handle clients and servers, and it functions for LAN connections. However when ...
0
votes
0
answers
57
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 ...
-1
votes
1
answer
110
views
select() returns 10038, Windows Socket error [closed]
I'm trying to make p2p application with login function. This application will send commands to server by console input and i'm tried to implement this but it finished on 10038 error which means that i'...
0
votes
0
answers
52
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 ...
0
votes
0
answers
106
views
GetNameInfo win API does not resolve Chinese computer names on Windows 11?
I have a small lab based Active Directory environment with 3 devices.
They have the following OS installed.
DC running Windows Server 2022 hosting my AD server.
1.Endpoint running Windows 10 Pro (22H2 ...
1
vote
0
answers
69
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
506
views
How to build a raw UDP packet in C++?
I am programming a code that sends a text message to a specific port using UDP. I initialize IP header and UDP myself. My problem is that the finished UDP packet is corrupted and Wireshark doesn't ...
0
votes
1
answer
105
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
49
views
Winsock.h External Dependencies not associating (or mis-associating) with members
I have been pulling an MFC-based application out into a purely console (standard windows libraries) application, and it has been mostly painless (if not tremendously tedious). I am currently trying to ...
0
votes
0
answers
79
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
1
answer
84
views
Do I have to call the WSAGetLastError() twice?
Platform: Windows 10 x64
MingW64 with Visual Studio 2022
I am writing a program to add timeout function to sockets. Below is a simplified version of the code.
As shown in the following code,...
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 ...
0
votes
0
answers
33
views
C++ 'inet_pton' Function cannot be used on Windows [duplicate]
These are my header files (on Windows):
When I compile the program, this error will be on the display:
'inet_pton' was not declared in the scope
I try to update my mingw but it's useless.
By the ...
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
votes
1
answer
161
views
WSAEACCES error returned after Windows update [closed]
Last year, I finally migrated my development environment from Win10x64 to Win11x64. The old Win10 computer has been powered off, except for the rare times I needed to look for an old file on it. The ...
1
vote
0
answers
123
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 ...
0
votes
0
answers
68
views
I have an issue creating a server socket on c++ for listening the connections via internet
I tried to make a server socket for connecting client sockets via internet. I found nothing in google.
Unfortunately, it works only with my local network. It responds when I connect to 127.0.0.1 ...
1
vote
2
answers
280
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 ...
2
votes
0
answers
244
views
How to specify the sending network adapter in Windows
I have run into the issue of Windows sending out messages from the wrong network adapter when there is more than one possible network adapters on the computer. Specifically, I have a computer ...
0
votes
1
answer
85
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
136
views
How to use ConnectEx(mswsock.h) with RIO(Registered I/O)?
I want to use RIO to get notifications from ConnectEx, but I didn't include RIOConnectEx in RIO_EXTIONS_FUNCTION_TABLE. I don't know how to get notifications about ConnectEx connections in ...
0
votes
0
answers
43
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
98
views
Trouble with Timestamp Communication Between Master and Slave Sockets in C
I have two functions in C that involve communication between a master and slave socket. The master sends a timestamp to the slave using the sendSyncMessage function, while the slave receives it using ...
0
votes
1
answer
117
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 ...
1
vote
1
answer
343
views
TCP client on Windows cannot bind() to port < 1023
I'm doing some testing with a TCP client on Windows 10 (10.0-19045) but due to firewall restrictions I need to run my experiments from a local port < 1024 (not negotiable).
I thought that this was ...
0
votes
0
answers
208
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 ...
3
votes
1
answer
361
views
Win32 getaddrinfo() not using C:\Windows\System32\drivers\etc\hosts?
Does Win32 getaddrinfo() use C:\Windows\System32\drivers\etc\hosts?
We want to use C:\Windows\System32\drivers\etc\hosts to specify IPv6-only addresses (which are NOT part of the DNS), and let our ...
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
1
answer
230
views
Idle timeout in tcp connection
I have some clients and a server on windows (I am using winsock for both client and server), the server is waiting for clients to get connected to it via tcp,
while waiting for almost 5 minutes after ...
0
votes
0
answers
146
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
1
answer
468
views
'getaddrinfo' was not declared in this scope
I'm trying to create a TCP server in C++. Below is my current code following Beej's tutorial:
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <ws2tcpip.h>
int main(){
...
0
votes
0
answers
102
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
1
answer
67
views
why is Cin.getline(); ending my connection to my socket? (networking) (socket programming)
Before I start I want to clarify that I'm using the socket code from microsoft as a template.
https://learn.microsoft.com/en-us/windows/win32/winsock/complete-client-code
I want to talk to a server 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
1
answer
180
views
I can no longer create a server listening on port 64951 or 64952 under Windows 10 [duplicate]
I can no longer create a server listening on port 64951 or 64952 under Windows 10.
I got an exception on my C# program when I tried to bind to 0.0.0.0:64951.
Same on a C++/Qt program, the error is : '...
0
votes
0
answers
333
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(...
1
vote
1
answer
172
views
TCP SYN RAW socket receive packet error 10022
I'm porting my program from Unix to Windows, and I have a problem with the recvfrom() function to accept a packet. I haven't written anything with Winsock until now. I think I've done everything, ...
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 ...
0
votes
0
answers
115
views
Where is the byte Array?
I have C++ code that uses GDI to take a screenshot of the environment, and GDI+ to compress it into a JPG. I want to send the image over TCP, and for that I need to know where the byte array that ...
1
vote
0
answers
108
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 ...
0
votes
1
answer
683
views
It is not obvious to use Registered I/O (RIO) Sockets to increase the data rate of receiving TCP,is this normal?
I recently received a task to receive TCP data as soon as possible on Windows. After checking a lot of information, I noticed that Registered I/O (RIO) Sockets may be a good choice, because it may ...