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

Non-blocking connect() with WinSocks

According to MSDN you have to create a non-blocking socket like this: unsigned nonblocking = 1; ioctlsocket(s, FIONBIO, &nonblocking); and use it in the write-fdset for select() after that. To check if the connection was successful, you have to see…
Patrick Glandien
  • 7,791
  • 5
  • 41
  • 47
3
votes
3 answers

Why wont a simple socket to the localhost connect?

I am following a tutorial that teaches me how to use win32 sockets(winsock2). I am attempting to create a simple socket that connects to the "localhost" but my program is failing when I attempt to connect to the local host(at the function…
sazr
  • 24,984
  • 66
  • 194
  • 362
3
votes
0 answers

How can I ensure that I bind() to and listen() on a "private", rather than "public" network?

In my C program foo.exe, I create a TCP socket using winsock2, bind() it to a specific port and listen() for incoming connections. Windows 10 throws up its firewall dialog and asks me if I want to allow foo.exe to receive connections (a) over…
jez
  • 14,867
  • 5
  • 37
  • 64
3
votes
2 answers

Delphi wrappers for getnameinfo and getaddrinfo

I'm trying to find Delphi wrappers for getnameinfo and getaddrinfo socket APIs. Does anybody know where to find them or has created them and would not mind to share?
gabr
  • 26,580
  • 9
  • 75
  • 141
3
votes
1 answer

Why is there no 64-bit API for winsock?

Calls such as send() and sendto() in the Winsock API take a primitive int to dictate the size of their buffer parameters. This obviously places a 32-bit limit on the maximum size buffer that may be sent. Why is this? Is there a 64-bit Winsock2 API…
rantman
  • 39
  • 4
3
votes
1 answer

PChar Invalid Pointer Operation on StrPLCopy

I write some TCP-server usin WinSock 2 and I hava procedure which catch FD_READ event. In this procedure I need to parse recieved message. The code is here: procedure TfrmMain.WndProc_OnWSANetEvent(var Msg: TMessage); Var iCurrThread, n :…
Dmitry Belaventsev
  • 6,347
  • 12
  • 52
  • 75
3
votes
3 answers

How do you create a TCP connection without a listener?

I am currently working on a C++ networking program using Winsock 2, it's a chatting program without a server between the two computers. It would be convenient if none of the users are forced to run a server program, which has a listener, it makes…
BubLblckZ
  • 434
  • 4
  • 14
3
votes
0 answers

Communicating with a DLL

I have an LSP (Layered Service Provider) DLL, but once it's installed in the catalog, how to i communicate with it in my program? My LSP is based largely off of Microsoft's sample LSP. I was reading komodia's write up on LSP DLL's and they state…
Dacto
  • 2,901
  • 9
  • 45
  • 54
3
votes
1 answer

Problem With Packet Delays on TCP/IP Windows 7 loopback adapter (or bug in software?)

We have a client and server application currently testing on the same Windows 7 64 bit machine. They're both written in C# and using P/Invoke to call out to the Winsock2 libraries. The application works fine overall w/o any errors. And the latency…
Wayne
  • 2,959
  • 3
  • 30
  • 48
3
votes
1 answer

Unexpected WSA_IO_PENDING from blocking (with overlapped I/O attribute) Winsock2 calls

Short version: I get WSA_IO_PENDING when using blocking socket API calls. How should I handle it? The socket has overlapped I/O attribute and set with a timeout. Long version: Platform: Windows 10. Visual Studio 2015 A socket is created in a very…
rnd_nr_gen
  • 2,203
  • 3
  • 36
  • 55
3
votes
2 answers

C++ Winsock2 Client not connecting to server through remote IP

I'm trying to learn the basics of network programming by using Winsock2 API. I've had success connecting through LAN IP addresses, but I've been struggling for over a day now trying to get the client to connect to my server through its public IP. I…
user7183038
3
votes
0 answers

undefined reference to `__imp_socket'

I'm doing a socket project on win10, and I get these errors. g++ -ggdb -std=c++11 -Wall -pedantic -o calcserver CalcServer.c DieWithError.c HandleTCPClient.c CalcFramer.cpp CalcParser.cpp C:\Users\HARRYS~1\AppData\Local\Temp\cceLC8Xb.o: In function…
Harry
  • 31
  • 3
3
votes
0 answers

socket option TCP_NODELAY on windows requires 8bit Bool?

Here is my example code (I am sorry it is quite long): #include "stdafx.h" #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include typedef BOOL OPT_TYPE; int _tmain(int argc, _TCHAR* argv[]) { …
kuga
  • 1,483
  • 1
  • 17
  • 38
3
votes
2 answers

C++ - Converting wchar_t to network-byte and back

The main reason is because I am sending Unicode data (bytes, not characters) over Sockets, and I wanted to make sure endianness matches up because wchar_t is UTF16. Also the receiving program is my other one, so I will know that it is UTF16 and be…
Trevin Corkery
  • 651
  • 7
  • 19
3
votes
0 answers

Windows Socket API: WSASendTo vs. WSASendMsg vs. TransmitPackets?

I don't understand the main difference between WSASendTo, WSASendMsg, and TransmitPackets for sending in-memory buffers: They all allow buffer gathering All of them allow overlapped (asynchronous) operation WSASendTo and TransmitPackets both allow…
user541686
  • 205,094
  • 128
  • 528
  • 886