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
3
votes
1 answer

Why do I get a flood of compiler errors when I include WinSock2.h?

I'm trying to make a UDP Flood using WinSock2.h in c++ but I'm getting over 70 errors and 17 warnings on just WinSock2.h and all the errors are redefinitions, syntax errors from ws2def.h, and "different linkages". Am I doing something wrong or is…
Logan
  • 51
  • 10
3
votes
2 answers

Is the WinSock2 sendto() function thread-safe?

I am currently developing a networking software that uses a datagram socket (UDP) to send data to clients. Whenever I'd like to send data to a client I am currently invoking sendto() and passing the respective parameters. Yet I am wondering whether…
BlackyPaw
  • 33
  • 6
3
votes
1 answer

IOCP notification without completion key

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…
Michael220
  • 193
  • 12
3
votes
3 answers

winsock compile error

The following errors are from a file with just windows and winsock2 included. C:\Users\ioil\Desktop\dm\bin>dmc sockit.c typedef struct fd_set { ^ C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(85) : Error: 'fd_set' is…
ioil
  • 101
  • 2
  • 3
3
votes
2 answers

Would like to evaluate a comparison between two sockaddr_in structs

Presently I am in the midst of constructing a peer-to-peer network architecture and am at the stage of creating a receive function which will accept messages from multiple clients on the network. Essentially when the recvfrom function is called -…
Enchanter
  • 117
  • 1
  • 10
3
votes
1 answer

Winsock ~ Creating an UDP Listener (Multiple vs 1 socket)

Dear Stackoverflowers, I am researching networking a bit and I decided I'd like to create a small and simple networking library with Winsock. (I am using Completion Ports and Overlapped IO though) As I researched a bit I came to the following steps…
user896326
3
votes
3 answers

Convert data to big endian

I'm using WinSock to send UDP packets to the server, I need to send the data in big endian. I'm not sure how to convert the byte order of my structure before sending. I have a struct like this: struct ConnectIn { std::int64_t ConnectionID =…
Drahcir
  • 11,772
  • 24
  • 86
  • 128
3
votes
2 answers

Is there any delphi winsock2 library?

i need to use WSASocket function etc ...
Qing Xu
  • 2,704
  • 2
  • 22
  • 21
3
votes
1 answer

select() equivalence in I/O Completion Ports

I am developing a proxy server using WinSock 2.0 in Windows. If I wanted to develop it in blocking model, select() was the way to wait for client or remote server to receive data from. Is there any applicable way to do this so using I/O Completion…
Amir
  • 820
  • 9
  • 30
3
votes
1 answer

WinSock2 HTTP GET usage

int RiotAPI::getSite(std::string hostname) //RiotAPI is my class, almost empty atm { if ( wsa ) //wsa is true, dont mind this. { ZeroMemory( &hints, sizeof(hints) ); hints.ai_family = AF_UNSPEC; hints.ai_protocol = IPPROTO_TCP; …
user2699298
  • 1,446
  • 3
  • 17
  • 33
3
votes
1 answer

Does WSASend send all WSABUF buffers as a single packet?

The title probably explains itself best. Anyway, I have a data buffer received from an another source, and I want to send it in a single UDP packet that contains a sequence number (as the first byte) -> I want to add the sequence number to the given…
Daniel Trugman
  • 8,186
  • 20
  • 41
3
votes
1 answer

Secure UDP Socket Programming

What are good programming practices in regards to blocking DoS attacks on a UDP client/server? The only thing that comes to mind at the moment is ignoring packets with the wrong sources, as such (using WinSock2): if (oSourceAddr.sa_family ==…
NmdMystery
  • 2,778
  • 3
  • 32
  • 60
3
votes
0 answers

Unable to capture the IPv6 multicast traffic for Windows 8

Following is the function I wrote to capture IPv6 multicast data coming on multicast address ff02::1 and port 9154. This code works fine on Windows Vista and Windows 7. But I am unable to capture the same traffic for Windows 8 (none of the winsock…
3
votes
4 answers

Winsock2: How to allow ONLY one client connection at a time by using listen's backlog in VC++

I want to allow only one connection at a time from my TCP server. Can you please tell, how to use listen without backlog length of zero. I m using the code(given below), but when i launch 2 client one by one, both gets connected. I m using VC++…
immi
  • 33
  • 1
  • 4
3
votes
2 answers

TCP Winsock: accept multiple connections/clients

I tried to can multiply clients, and send it to each one. But it working only for one, after one client connected the server just useless for incoming connections. while(true) { if(Sub = accept(Socket, (sockaddr*)&IncomingAddress, &AddressLen)) …
Ido Hadar
  • 179
  • 3
  • 5
  • 13