winsock

Receiving image through winsocket

hey guys, i have a proxy server running on my local machine used to cache images while surfing. I set up my browser with a proxy to 127.0.0.1, receive the HTTP requests, take the data and send it back to the browser. It works fine for everything except large images. When I receive the image info, it only displays half the image (ex.: the...

C windows sendto()

I am trying to send over UDP using the following code, but i'm getting strange results. if((sendto(newSocket, sendBuf, totalLength, 0, (SOCKADDR *)&sendAddr, sizeof(sendAddr)) == bytesSent) < 0) { printf("Send error! - %d\n", WSAGetLastError()); } However say when the totalLength variable is set to 30 the sendto functio...

Non blocking socket from within a DLL (no window)

Hi all, I have a DLL wich connects to a server through a single socket. I am facing the following problem : If server's IP address & port are false or server is down, the application using this DLL freezes until half a minute. My idea is to use non-blocking sockets to avoid that problem, by showing a window indicating connection progres...

Getting Recv-Q/Send-Q in Windows?

In linux, you can get the following statistics with netstat: Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0 192.168.1.136.58519 72.47.210.69.80 LAST_ACK tcp4 37 0 192.168.1.136.57059 174.129.27.181.443 CLOSE_WAIT ...

Skipping data in winsock?

Is it possible to skip a portion of the incoming data on a TCP stream socket, instead of having to read it into a buffer? Preferably, I'm looking for something that also works asynchronously. ...

Multithreading won't work as expected

Hello, I have a problem with my program. I wanted it to have two threads, one of them listening for connections, and the other one receiving data from them... Unfortunately, it acts strangely. It will ignore my cout and cin usage everywhere in the code, so I can't even debug it. May I ask that someone sheds some light on it? Thank you in...

TCP send/recv error reporting

I have a client/server program (Windows, winsock2) which communicates over TCP. The client connects and sends data to server (using send) in 8K at a time. The server just reads data (using recv). No special settings done on sockets. Problem: When some network error occurs during the communication (e.g. cable pulled out), receiver do no...

Networking Method

Hey guys, Iv'e noticed that when I send a complete packet (collect it's data in a buffer and send) it is much slower than sending the packet byte by byte. Will it be okay if I make an online game using this method? ...

How to implement icmp packet handler using winsock version 1.1?

I am working on an very old application right now. I need to make change in this application to listen for coming icmp request and decide to reply or drop the packet (kind of access control on ICMP). The application is Winsock version 1.1 based. I tried different ways to create a socket and capture icmp packet using the socket. But none ...

Most effective way to connect/retry connecting using C#?

I am creating a little game client that will end up connecting to a server to gather some information on available games to play, how many players are playing, and all kinds of other stuff that you can imagine it ought to do. My difficulties come in finding an effective way in dealing with the connect/retry connect sequence upon first l...

timeval undefined when using windows.h and WIN32_LEAN_AND_MEAN

To avoid conflicts with winsock2.h, I want to wrap my include of windows.h with WIN32_LEAN_AND_MEAN (I undef it after windows.h so as not to interfere with applications that include my headers). Doing this causes timeval to be undefined when winsock2.h isn't included. Including time.h doesn't define timeval either. How can I get timeval...

How to Re-order the network interfaces returned by WSAIoctl with SIO_GET_INTERFACE_LIST control code

Is there a way to dictate the order of the network interfaces returned by the Win32 WinSock WSAIoctl function's SIO_GET_INTERFACE_LIST functionality? Background: We've got a heterogeneous CORBA system where a nameservice running the ACE/TAO CORBA implementation on Windows has ACE/TAO-based services registered with it that clients imple...

BSD socket compatible wrapper around winsock?

I'm attempting to port a Linux application to Windows. The application isn't too complex, using all fairly standard code, with few external dependencies. The main dependencies are libelf (which compiles fine under mingw), pthreads (there appears to be a win32 version available), and sockets. The main problem is with sockets...Windows pro...

How does a TCP/IP packet reach to a specific server socket?

I understand that when a TCP client connects to a server, it automatically uses a unused local port unless specified explicitly. On the server side, we have a listening socket which creates a new socket whenever a new connection is accepted. But all server sockets use same local port (I checked this with netstat). My question is how doe...

Problem with winsock recv() and accept()

I'm having trouble with a socket application I'm programming in C++. I'm doing my programming with Bloodshed Dev-Cpp on Windows XP. I made a class for handling all the message transfers and have a client and server program that both use that class for handling their services. The application itself is very basic, the only intent I hav...

VB.NET - Winsock GetData Method

Hey guys, I imported the Winsock feature in my vb.net application, so I can make a Chat System. I just have one little problem with my program. In the GetData method of my program, CLIENT SIDE: *Dim strData As String* AxWinsock1.GetData(strData, vbString) TextBox1.Text = TextBox1.Text & _ strData & vbCrLf It will under...

Why is my call to TransmitFile performing poorly compared to other methods?

First, a bit of background -- I am writing a basic FTP server for a personal project. I'm currently working on retrieving files. My current implementation looks like this: HANDLE hFile = CreateFile("file.tar.gz", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); TransmitFile(sd, hFile, fileSize, 65536, NU...

Can't create socket on Windows

I have quite an embarrassing problem. The following code simply will not create a socket on Windows; it fails and displays the error message. Could anyone briefly explain why this might be? I'm incredibly confused and frustrated that something so simple is failing. Thank you. int sock; if( (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) ...

MinGW linker error: winsock

Hello, I am using MinGW compiler on Windows to compile my C++ application with sockets. My command for linking looks like: g++.exe -Wall -Wno-long-long -pedantic -lwsock32 -o dist/Windows/piskvorky { there are a lot of object files } and I have also tried g++.exe -Wall -Wno-long-long -pedantic -lws2_32 -o dist/Windows/piskvorky...

UDP socket problem.

I'm writing a multiplayer game (obviously using UDP sockets. note: using winsock 2.2). The server code reads something like this: while(run) { select(0, &readSockets, NULL, NULL, &t) if(FD_ISSET(serverSocket, &readSockets)) { printf("%s\n","Data receieved"); //recvfrom over here } FD_SET(serverSocket,...