winsock

vb6 winsock control RemoteHostIP truncates the last digit from IP address

Hi i am writing a socket client/server application in VB6. i have the following code Private Sub sockMain_ConnectionRequest(ByVal requestID As Long) If sockMain.State <> sckClosed Then sockMain.Close End If sockMain.Accept requestID Debug.Print "Accepted connection from: " & sockMain.RemoteHostIP & vbCrLf End...

Have winsock's send function block?

Is it possible to have winsock's send function block until the packet being sent is received at the other end? My end goal is to be able to send 5-20mb files while still being able to send small 1kb packets on the same connection. So I was thinking I would have it block until the receiver receives the packet. That way if another small p...

Scanning LAN game servers using winsock

I'm trying to figure out how to use winsockets to be able to turn my game into a LAN-playable game. I've read some winsockets documentation but I can't figure out how a client can get all the games that were created on LAN. Does it have to try to 'connect' to each IP on LAN, like trying to connect to 192.168.0.1, then 192.168.0.2, etc? ...

Send UDP broadcast on Windows 7

I have a PC with two network cards connected to different networks (multi homed network setup). I want to send UDP broadcast frames on both networks. The senders IP address of the frames must be the IP address of the adapter, that is used to send the frame. The destination address should be the LIMITED BROADCAST address. The customer ap...

how to capture packets in a Windows application that must be installed as non-admin?

Hi, Is it possible to write a Windows app that can capture packets on the PC such that this application can be installed/run as non-admin? If yes, what would be the approach, e.g. which language, which API/Library to use etc (e.g. would it be with the Windows Sockets 2 (Winsock) library?) I've looked at Network Monitor API's however t...

WSCInstallProviderAndChains allways fails

Hi i am trying to use this functions with parameters at first i load the ws2_32.dll with Loadlibrary then i get the function rc = lpInstallProviderAndChains( providerGuid, //guid lpszLspPathAndFile, //filename lpszLspName, //name ( IfsProvider ? XP1_IFS_HANDLES :...

Why are there WSA pendants for socket(), connect(), send() and so on, but not for closesocket()?

Hi, due to my lack of english skills, I'm going to try to explain what I mean using a few examples: socket() -> WSASocket() connect() -> WSAConnect() send() -> WSASend() sendto() -> WSASendTo() recv() -> WSARecv() recvfrom() -> WSARecvFrom() ... closesocket() -> WSA???() This is nothing that matters much, still something that gives ...

WSASYSCALLFAILURE with overlapped IO on Windows XP

I hit a bug in my code which uses WSARecv and WSAGetOverlapped result on an overlapped socket. Under heavy load, WSAGetOverlapped returns with WSASYSCALLFAILURE ('A system call that should never fail has failed') and my TCP stream is out of sync afterwards, causing mayhem in the upper levels of my program. So far I have not been able to...

Winsock, accept request only from specific IP address

How can I make a Winsock program accept connection requests only from specific addresses? I would like denied connections to be ignored completely rather than get a TCP rejection. ...

Winsock blocking sockets, multithreading deadlock

I have tracked down a deadlock in some code of mine using this reproducer: if( isClient ) { Sender sender; Receiver receiver; ConnectionPtr connection = Connection::create( description ); TEST( connection->connect( )); receiver.start(); Sleep( 100 ); sender.start(); sender.join(); } else { Connectio...

Maximizing performance on udp

hey. im working on a project with two clients ,one for sending, and the other one for receiving udp datagrams, between 2 machines wired directly to each other. each datagram is 1024byte in size, and it is sent using winsock(blocking). they are both running on a very fast machines(separate). with 16gb ram and 8 cpu's, with raid 0 drives. ...

What VB6 socket component can reuse bound ports?

I'm updating legacy code written in VB6 using Winsock controls. Essentially, I'm trying to connect 4 computers across a local network such that the computers can share files between each other when needed. Originally, once a connection was established, they held onto them indefinitely. These would error after 12-24 hours, however, and co...

Multipe Send()'s and Recv()'s using Winsock2

Hello, I am working on a small networking project using Winsock2. I am using a TCP connection and actually am working with IRC as an example since IRC is fairly simple. What I am doing is connecting to the server and sending an initial buffer so the server recognizes a connection. This works fine. What concerns me is that I cannot writ...

How to cancel waiting in select() on Windows

In my program there is one thread (receiving thread) that is responsible for receiving requests from a TCP socket and there are many threads (worker threads) that are responsible for processing the received requests. Once a request is processed I need to send an answer over TCP. And here is a question. I would like to send TCP data in ...

Ending "recv()" loop when all information is Read using Winsock

Hey everyone, I am having an issue in my recv() loop for winsock. I am trying to terminate the loop when iResult==0, however, the loop only ends when the socket closes. It appears to be hanging at the very last recv() where iResult would equal 0. So any ideas on how to terminate the loop effectively? My ultimate goal (whether iResult ==...

Winsock's connect() permanently returns WSAETIMEDOUT, but PuTTY connects on the same port

Hello, Probably the weirdest bug I've encountered so far. I need to connect to some 3rd-party application running under Windows XP Embedded. Network connectivity present and works: I'm able to connect to the expected port using PuTTY running on Windows XP SP3 and perform some telnet-like operations. Now, my application is a very simple...

Multiple sockets for clients to connect to

Is it possible to have multiple sockets, which can either by TCP or UDP in one program? For example: SocketOne: TCP socket at port 4567; socketTwo: TCP socket at port 8765; socketThree: UDP socket at 7643. The families will be AF_INET, and addresses will be INADDR_ANY for each. I bind and listen for TCP, and just bind for UDP. What ...

How to investigate client side WSAECONNABORTED happening very often only on machines with NVDIA Quadro?

We have a C++ client/server application in which the client retrieves and renders 3D content from a server. Our client disconnects from the server very often (more than 50% of runs after less than 1 minute) with recv failing and WSAGetLastError returning WSAECONNABORTED. But the strange thing is that this happens only when: the client...

How do I retrieve an error string from WSAGetLastError()?

I'm porting some sockets code from Linux to Windows. In Linux, I could use strerror() to convert an errno code into a human-readable string. MSDN documentation shows equivalent strings for each error code returned from WSAGetLastError(), but I don't see anything about how to retrieve those strings. Will strerror() work here too? How ...

Can calling WSAStartup() from several threads cause a deadlock?

I'm developing an app that has one TCP server and several UDP servers/listeners. Each server is a separate thread, same as the worker threads for established TCP connections. I'm calling WSAStartup() in each of the threads. Sometimes, calling WSAStartup() hangs (it looks like a deadlock to me). Here is the stack trace: ntdll.dll!_Ki...