winsock

C++ Windows HTTP

Hi, I'm looking for a basic tutorial for connecting to a domain and downloading the index file . Anyone that can link me a good example or anything. ...

WinSock best accept() practices

Imagine you have a server which can handle only one client at a time. The server uses WSAAsyncSelect to be notified of new connections. In this case, what is the best way of handling FD_ACCEPT messages: A > Accept the connection attempt right away but queue the client until its turn? B > Do not accept the next connection attempt until ...

TCP and UDP are using different OS Buffer?

HI all. Here is the scenario. I have port 8888 for my program to use. I build a TCP and a UDP listener on that port. (This can do, c# allows, because they are two different protocols) My question is If the network traffic is very busy, TCP sockets may refuse or signalling the other end to stop sending things, it is called congestion...

SO_LINGER and closing sockets(WINSOCK)

hey. im writing a multithreaded winsock application and im having some issues with closing the sockets. first of all, is there a limit for a number of simultaneously open sockets? lets say like 32 sockets all in once. i establish a connection on one of the sockets, and passing information and it all goes right. problem is when i disconn...

C++ Winsock P2P

Scenario Does anyone have any good examples of peer-to-peer (p2p) networking in C++ using Winsock? It's a requirement I have for a client who specifically needs to use this technology (god knows why). I need to determine whether this is feasible. Any help would be greatly appreciated. EDIT And I would like to avoid using libraries so...

bluetooth winsock error 10049 on connect()

Hi.. I'm developing a dll in visual-c++ for client side application to connect my pc to my android phone via bluetooth. I use this function to find my bluetooth service on the phone(see commented code!): bool BlueRayXVR::findPairedService(GUID* guid, _SOCKET_ADDRESS* ret){ this->checkStartup(); HBLUETOOTH_DEVICE_FIND found_dev...

GetAcceptExSockaddrs returns garbage! Does anyone know why?

[I've followed the suggestion to use Winsock.pas, but it still writes garbage -- although the sin_family field has changed to a new garbage value.] Hello, I'm trying to write a quick/dirty echoserver in Delphi, but I notice that GetAcceptExSockaddrs seems to be writing to only the first 4 bytes of the structure I pass it. program TC...

SocketAsyncEventArgs and buffering while messages are in parts

C# socket server, which has roughly 200 - 500 active connections, each one constantly sending messages to our server. About 70% of the time the messages are handled fine (in the correct order etc), however in the other 30% of cases we have jumbled up messages and things get screwed up. We should note that some clients send data in unic...

Winsock Select() function gives 0xC00000FD exception

Hello, I've a select based server. Sockets are in blocking mode,but for select() function I'm using 250 ms. timeout. Basically my server accepts only one client and sending data to that client. It is working for weeks without problem if I just send data from server to client. But I realized that if client sends data to server after 3-4...

Receive many datagrams from several hosts using winsock

Dear stackers. I am developing an application that distributes rendering across several devices (a university project). Each frame consists of several blocks (16x16 pixels), and each device is "assigned" a number of blocks to be rendered. These blocks, when rendered, are compressed and serialized into a buffer until the max size of thi...

Winsock WSAAsyncSelect sending without an infinite buffer

Hi, This is more of a design question than a specific code question, I'm sure I am missing the obvious, I just need another set of eyes. I am writing a multi-client server based on WSAAsyncSelect, each connection is made into an object of a connection class I have written which contains associated settings and buffers etc. My question...

An IOCP documentation interpretation question - buffer ownership ambiguity

Since I'm not a native English speaker I might be missing something so maybe someone here knows better than me. Taken from WSASend's doumentation at MSDN: lpBuffers [in] A pointer to an array of WSABUF structures. Each WSABUF structure contains a pointer to a buffer and the length, in bytes, of the buffer. For a Winsock...

Non-blocking TCP buffer issues.

Hi! I think I'm in a problem. I have two TCP apps connected to each other which use winsock I/O completion ports to send/receive data (non-blocking sockets). Everything works just fine until there's a data transfer burst. The sender starts sending incorrect/malformed data. I allocate the buffers I'm sending on the stack, and if I unde...

How do I handle partial write completions from overlapped I/O using I/O Completion Ports

On Windows I/O completion ports, say I do this: void function() { WSASend("1111"); // A WSASend("2222"); // B WSASend("3333"); // C } If I got a "write-complete" that says 3 bytes of WSASend() A were sent, is it possible that right after that I'll get a "write-complete" that tells me that some or all of B & C were sent, or...

Validity of a Socket

I have created a socket using the following lines of code and i get a valid socket and connection is established between the client and server machines. Is there a possibility that the socket becomes invalid due to network disturbances or any other reason. If so how do we check whether the socket is valid or not. SOCKET SocServer; ...

winsock component

i have a winsock component made with vb.net in a class library that has events. how do i make it appear in tool box if i reference the dll in another project.? How do i use it in my c# program? thanks ...

Do I have to bind an UDP socket in my client program, to receive data? (I always get WASEINVAL)...

Hey There, I have the following problem: I am starting WSA, then I am creating a UDP socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP) and try to recvfrom on this socket, but it always returns -1 and I get WSAEINVAL (10022)... I don´t know why?... When I bind the port, that does not happen... But it is very lame to bind the clients socket......

WSASend() with more than one buffer - could complete incomplete?

Say I post the following WSASend call (Windows I/O completion ports without callback functions): void send_data() { WSABUF wsaBuff[2]; wsaBuff[0].len = 20; wsaBuff[1].len = 25; WSASend(sock, &wsaBuff[0], 2, ......); } When I get the "write_done" notification from the completion port, is it possible that wsaBuff[1] will...

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 already defined } fd_set; ^ C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(88)...

How to use CFNetwork to get byte array from sockets?

Hi, I'm working in a project for the iPad, it is a small program and I need it to communicate with another software that runs on windows and act like a server; so the application that I'm creating for the iPad will be the client. I'm using CFNetwork to do sockets communication, this is the way I'm establishing the connection: char ip[...