winsock

How to correctly parse incoming HTTP requests.

Hello all, i've created an C++ application using WinSck, which has a small (handles just a few features which i need) http server implemented. This is used to communicate with the outside world using http requests. It works, but sometimes the requests are not handled correctly, because the parsing fails. Now i'm quite sure that the requ...

MFC winsock1 and 2

Hi all, I'm deep in trouble with my project. I have to link two radar with my program, but the first has its own library that uses winsock, while in the second I want to use winsock2. How can i do that? At the moment i get many redefinition errors from the includes within winsock.h and winsock2.h. Take into account that the first ra...

How do web servers avoid TIME_WAIT?

I'm writing a simple HTTP server and learning about TIME_WAIT. How do real web servers in heavy environments handle requests from thousands of users without all the sockets getting stuck in TIME_WAIT after a request is handled? (Not asking about keep-alive -- that would help for a single client, but not for thousands of different clien...

Is it normal for WSASend to fail during big file transfers?

I need a little help if someone's got a minute. I've written a web server using IO completion ports, but I am having some trouble sending out large files. Web pages seem to load fine, but during large file transfers, WSASend() fails after a few minutes with error "The specified network name is no longer available." Right now, my server ...

ensuring packet order in UDP

hey. im using 2 computers with an application to send and recieve udp datagrams. there is no flow control (ICMP disabled) frequently when i send a file as udp datagrams via the application, i get 2 packets changing their order and therefor - packetloss. is there a way to make sure winsock and send() will send the packets the same way th...

Winsock: How to stop sending/receiving without closing the connection

Hi there, I am not very familiar with winsock or network programming, so I hope you forgive me if I am asking stupid stuff :) I develop a client/server application which share some camera images. The general cycle is: The client captures a camera image and compress it to an binary image. After that it sends it to the server The serve...

How do you clear the receive buffer in WinSock

I went searching for this and found at least one person who asked but got no answer. I think there is a need to start a send and receive segment (part of a larger process on same socket connection) and expect that there is nothing already in the receive buffer. I saw no answer but did think of this kludge before I myself realized anothe...

Determining the size of the next UDP datagram in system's queue

I want to know the size of the next UDP datagram in the system's queue. I found this question with a similar doubt, but using boost. The last answer (as of 2010/09/23) say something about using getsockopt with the SO_NREAD option in OS X, but I can't find anything about this with Windows (using Winsock). Here I found that I can use ioc...

How can I perform network IO at the very end of a process' lifetime?

I'm developing a DLL in C++ which needs to write some data via a (previously established) TCP/IP connection using the write() call. To be precise, the DLL should send a little 'Process 12345 is terminating at 2007-09-27 15:30:42, value of i is 131' message over the wire when the process goes down. Unfortunately, all the ways I know for ...

What are some applications that I can develop using winsock apart from chat and file sharing applications?

I am new to socket programming and I am looking for more info about what I can do with winsock. ...

General question about winsock's recv-function

Hi, I've got a general question about the recv-function of winsock. I write a programm with a client/server-architecture where the client sends a camera image to the server and the server sends another image back to the client. The client sends serveral images until the program is closed. And the server will responds every received imag...

Windows IOCP - any advantage for single-socket application?

As I understand IOCP under Windows Server 2003/2008 and C++ programming, they are more-or-less the highest performance way to service either multiple sockets, instead of select, or to tie together multiple threads to service those requests. If my program has but a single socket however, and given other constraints will generally read on...

Why recv() in winsock client cannot get any data once httpRetransmition happens?

Hi guys, I am trying to record the time between 'http request' package and 'http response' package. I write an socket client using winsock. The code is below if (send(sock, request.c_str(), request.length(), 0) != request.length()) die_with_error("send() sent a different number of bytes than expected"); //...

How to test winsock apps with bound connect AND listen sockets?

I am trying to connect two of the same app with winsock, but the connecting side has to use ConnectEx() which requires a bound socket. So the problem is that when I try to loop back using ip 127.0.0.1, I get error 10048(WSAEADDRINUSE). Is there any way around this problem? Thanks for any help ...

C#.net sockets upload rate

I have a class that uses sockets to send and receive data asynchronously over the network: class Client { private Socket mSocket; /* ... */ public void SendPacket(byte[] data) { mSocket.BeginSend(data, 0, data.Length, SocketFlags.None, OnSent, null); } private void OnSent(IAsyncResult ar) { ...

how to compare two endpoint address with C++ in windows:

bool checkSockaddr(sockaddr_in a, sockaddr_in b) check if they two have the same address information. ...

udp winsock programming

Hi, I'm the beginner in socket programming. I want to receive udp packets continuously from the port. For that I created socket and using bind and recv calls I have done with my program. In a buffer I'm storing the udp packets. How to receive packet by packet. How to put condition for particular time interval? Thanks in advance. stati...

MASM winsock error?

Hello everyone, I'm following along with a winsock tutorial in MASM's syntax called: Iczelion's Guide to Winsock Programming I'm stuck, I receive an error but I don't know how to fix it. The thing is that everytime I try to connect to a server with my socket, I receive a WSANOTSOCK error (a socket opperation is preformed on something th...

How to determine Local Port for a socket established in VB6

In a VB6 Application, I am looking for a way to determine the Local Port for the duplex socket. I have the remote Ip and Port, but I need to know an print out the local port as well. ...

What is the difference in windows socket (winsock.dll) implementation between Windows XP and Windows 2k3?

Background: I have an URL with a valid host and port, and invalid path. Opening up a java.net.Socket on XP with a timeout of 0 (no timeout) fails immediately. The same code hangs indefinitely on W2k3. Question: Where can I find documentation explaining the difference in winsock implementation and/or registry settings between XP and ...