FAQ Database Discussion Community


IOCP notification without completion key

c,winsock,winsock2,iocp
I am building an IOCP/RIO Winsock server and have been struggling with getting the proper notification from the completion port when my AcceptEx() calls are triggered by a client request. When I call GetQueuedCompletionStatus() after having sent a client request, I will get a successful return but without the completion...

WSASend completion routine has never been called

c++,windows,winsock,winsock2,overlapped-io
I'm playing around with Overlapped IO and suddenly found out that it looks like I'm the only one who can't encourage Completion callback to work (All claims was about: it works and I don't like it). The idea of my application is: a client (telnet localhost 27015) connects to the...

std::exception while starting server (WinSock2)

c++,visual-c++,winsock2
I am new to C++ and I am currently learning from a tutorial how to use winsock(2). However I run into a problem with my server. I have no idea how it happens. #include "stdafx.h" #include <WinSock2.h> #include <winsock.h> #pragma comment(lib, "Ws2_32.lib") using namespace std; void cmdError(string e =...

How to interrupt other std::threads c++

c++,multithreading,winsock2
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...

Socket c++: recv function returns -1

c++,c,sockets,winsock2,recv
I'm trying to code a simple android client communicating with a windows server. I'm using sockets to achieve that and up to now, I was testing everything with a Linux machine (android client and linux server). So far, everything was working. Now i'm trying to set it up on windows...

How can others connect on my AHKsocket winsock server? External IP?

connection,ip,autohotkey,tcp-ip,winsock2
Using AHKsock (AutoHotkey), I built a minimalistic client-server system with AHKsock_Connect, AHKsock_Send and AHKsock_Listen on both sides to communicate with each other. It works and I can send messages back and forth, if I connect to the server using localhost. But I want the server to be accessible from everywhere....

Should I use different WSAOVERLAPPED struct for WSASend and WSARecv?

windows,sockets,winsock,winsock2
I'm developing a server-client application using WinSock. Does using the same WSAOVERLAPPED with both WSASend and WSARecv works well? Should I use different WSAOVERLAPPED struct for WSASend and WSARecv?...

recv function always gives me the same buffer

c++,sockets,winsock,winsock2
This question is kind of a follow-up of a question that I previously asked. Basically I had a c++ server running in ubuntu and I'm now trying to make this code works in windows. I am having some issues with windows socket as it's my first time using them. After...

Pinvoke / call native Windows API function from C#

c#,dll,winsock,winsock2,winsockets
from within my C#-application I use functions of an external DLL. This DLL itself uses network functions. So it is necessary to initialise Winsock out of my C#-application to let the network sockets work for this DLL. That's how I try to execute WSAStartup for initialisation, but it does not...

UDP client does not receive data without bind()

c,sockets,udp,winsock2,udpclient
I refereed to the UDP client program from binarytides and I was able to send a UDP packet frompy PC to the UDP server which is My embedded device and this device echoes back a UDP message. In this PC-UDP client code it is expected to get the echoed message...

WSARecv() and multiple buffers

c++,c,sockets,asynchronous,winsock2
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 means I can receive 48...

C++ Winsock struct send/recv

c++,sockets,struct,winsock2
I am attempting to send a struct via a winsock UDP socket from client to server, but I am not receiving the same bytes that have been sent, or at least not being to reassemble the struct correctly. struct Header { uint16_t sender; uint16_t number; uint16_t packetSize; uint16_t type; };...

WSASend Buffer to String

c++,winsock2,packet-capture
How I can get the Winsock2 WSASend() Buffer into a string? This is the code I currently have, and it write only a lot of Icharacters. int WINAPI Hook_WSASend(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6) { int rv = 0; char * buf...