winsock2

C++ - Simple server which sends simple HTML to clients

Now, I'm just fooling around with this and I'm not sure as to why this isn't working. #include <winsock2.h> #include <ws2tcpip.h> #include <iostream> #include <cassert> const char html[] = "HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-type: text/html\r\n" "\r\n" "<html>\r\n" "<head>\r\n" "<title>Hello, world!</title>\r\n" "</h...

linux to windows C++ byte array

Hello, I have to replicate the following Java functionality in C++ to get data from Linux to Windows. Is Winsock2 the best way to go?. Also, any reference code to suggest? TIA, B import java.nio.ByteBuffer; public class MessageXdr { private ByteBuffer buffer; private int size; // taille max corps de message privat...

Delphi TClientSocket replacement using winsock2 and IOCP?

Is there such a thing? It needs to be asynchronous (no Indy). ...

How can I list for each Windows TCP socket the status of SO_LINGER?

I want to verify that a group of sockets do (or do not) have the SO_LINGER option set on them, but the end I care about isn't my program. Basically, my program is getting an unexpected network reset (RST) and I believe it's because the server is setting SO_LINGER and the client isn't pulling the data fast enough. I can find plenty of w...

Calling WinSock functions using LoadLibrary and GetProcAddress

Basically I have a header file like this: #if WIN32 typedef DWORD (WSAAPI *SocketStartup) (WORD wVersionRequested, LPWSADATA lpWSAData); typedef SOCKET (WINAPI *MakeSocket)(IN int af, IN int type, IN int protocol, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, IN GROUP g, IN DWORD dwFlags ); typedef DWORD (WINAPI *SocketSendFu...

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

Hi Everyone, 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++ with winsock2. listen(m_socket,-1); passing zero as backlog is also not work...

Windows RSVP QoS service is stopped when no QoS-socket active. Can that be changed?

We have a program that uses QoS-sockets, our softphone application uses QoS for the RTP. That application is normally left running, sometimes however it is restarted. (Stop, wait 300ms, start.) We have found that when the softphone-application is stopped that the last one useing QoS on the server, so the RSVP QoS-service on windows is ...

Is it possible to tell if WSAStartup has been called in a process?

I've started writing an ActiveX control that makes use of sockets. Applications that use this control may or may not also use sockets. Is it possible for my control to tell whether WSAStartup has been called? If not, call it. A little test reveals that calling WSAStartup multiple times is tollerated. But what happens if a different wi...

Bind Error 10038 with windows socket application in c.

I am testing out a Socket Server application in c and I am getting an error on the bind function with code 10038. I looked this up and MSDN says it means: An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid....

"Disabled use of AcceptEx() WinSock2 API" error on Windows 7 using Tomcat

When starting Tomcat 6 on Windows 7 Enterprise with JRE 6 using C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\tomcat6.exe the application does not open and my event viewer has the message: "Disabled use of AcceptEx() WinSock2 API." The same installer of Tomcat worked on Windows Vista before I upgraded my operating system. ...

Issue with gethostbyname on 64-bit Windows

I am trying to migrate some code from 32-bit Windows (XP and Server 2003) to 64-bit Windows 7, and I am having a weird problem with gethostbyname. I'm doing something like this: struct hostent *hp; hp = gethostbyname( host ); After the call to gethostbyname, the pointer hp->h_addr_list is invalid. It has all the right numbers, but i...

Socket programming Xp > Vista, Vista > XP

I am developing a program which sends images from one computer to another (similar to remote assistance without mouse/keyboard input). The two computers I use to test this are one Windows XP machine and one Windows Vista. I have the stationary XP machine directly connected to a router, and a laptop which is connected through wireless. ...

Winsock2 recv() hook into a remote process.

Hello! I was trying to hook a custom recv() winsock2.0 method to a remote process, so that my function executes instead of the one in the process, i have been googling this and i found some really good example, but they lack description typedef (WINAPI * WSAREC)( SOCKET s, char *buf, int len, int flags ) = recv; Now my question is, wh...

Winsock Connect Problem with Eset Nod32

Dear All, my socket library which is implemented using winsock2 is working properly. But when ESET Nod32 installed on the computer, connect() function returns 0(zero) ,that is success, even if remote host is not available. I looked with netstat -b command and saw that ekrn.exe is accepting the client. And after couple of seconds it sen...

Problem creating socket with C++ in winsock2

Hi, I'm having the weirdest problem causing me headaches. Consider the following code: // Create and bind socket std::map<Connection, bool> clients; unsigned short port=6222; struct sockaddr_in local_address, from_address; int result; char buffer[10000]; SOCKET receive_socket; local_address.sin_family = AF_INET; local_address.s...

What to use instead of getaddrinfo() and freeaddrinfo() targetting legacy Windows?

By requirement, I'm targeting old legacy Windows systems (9x branch) where getaddrinfo() and freeaddrinfo() are not available. What can I use instead of that? The code I'm using right now is extracted from the MSDN site (I'm testing it in a Vista computer): ... /* WinSock data: */ WSADATA wsaData; /* Initialize the WinSock data: */ sho...

Is it possible to use connection proxies using sockets?

Hi, I need to connect to a server from an environment with a SSL proxy on, is it possible to handle that environment using just sockets? Is it was a no-SSL proxy, would that be possible? Thank you very much. ...

Is there any way to use getaddrinfo() and freeaddrinfo() and still be the program compatible with legacy versions of Windows?

Hi, in the Winsock2 library getaddrinfo() and freeaddrinfo() was only added in Windows XP and on. I know how to replace them in legacy systems, but a conditional use depending on the Windows version won't help. The application won't start in 9x with a message saying that it was linked to a missing export in WS2_32.dll. I'm using MinGW ...

Is there any delphi winsock2 library ?

i need to use WSASocket function etc ... ...

Winsock tcp/ip Socket listening but connection refused, race condition?

Hello folks. This involves two automated unit tests which each start up a tcp/ip server that creates a non-blocking socket then bind()s and listen()s in a loop on select() for a client that connects and downloads some data. The catch is that they work perfectly when run separately but when run as a test suite, the second test client w...