winsock

hostname not translated into an IP address using Winsock

Question: The getaddrinfo() does not translate a hostname into an IP address and consequently does not connect() to server. Is something wrong with my implementation - compiles with no warning messages? EDIT: Is this function call to connect correct? ... connect(client, result->ai_addr, result->ai_addrlen) ... Full implementa...

How to distinguish a Win32 socket handle from other pipe handles?

I need to determine whether a handle that my code did not create, for which GetFileType()==FILE_TYPE_PIPE, is a socket or not. There does not seem to be an API for this. I have tried the following. The general idea is to use a socket-specific function and treat failure as meaning non-socket. getsockopt() -- This was my first attempt. ...

winsock weirdness (c++)

I am trying to implement a function called "inet_pton" which will convert a string representation of an IPv4 or IPv6 (like "66.102.1.147" [google]) into binary network-byte ordered form. Here is the relevant part of my code: #if defined WIN32 int inet_pton (int af, const char *src, void *dst) { const void *data; size_t le...

How to write socket communication program using win32

New guy want to learn about socket programming in win32. I know bit of MFC but thats not good point to start as it just hides the internal details form programmer. ...

Pragmatic General Multicast on Winsock

Has anyone any experience of using PGM at the winsock (not MSMQ) level on Windows? It looks like a useful reliable multicast protocol (a la TIBCO Rendezvous) and I assume that it would be possible to make something like this really fly if run over native completion-port based I/O. I've dabbled with it, at a C++ level, by writing some bo...

Delphi, How to get all local IPs?

Any one know a way in delphi get a simple list (eg tstrings) of the local ip address. I have had a look at the other related question, and cant seem to get my head around converting them to delphi. ...

send(), returns Winsock Error 10038

Problem: Call to send(), returns Winsock Error 10038 against socket handle Illustration: acceptedSocket = accept (server, (sockaddr *)&sin, &len); accept(), returns 0 A new thread, is created for each connection send(), (in thread function) returns 10038 Illustration: - in thread function //omitted SOCKET RemoteSocket = (SOC...

Count the number of packets sent to a server from a client?

So I'm almost done an assignment involving Win32 programming and sockets, but I have to generate and analyze some statistics about the transfers. The only part I'm having trouble with is how to figure out the number of packets that were sent to the server from the client. The data sent can be variable-length, so I can't just divide the ...

How to cope with high frequency data?

I have a C++ application which receives stock data and forward to another application via socket (acting as a server). Actually the WSASend function returns with error code 10055 after small seconds and I found that is the error message "No buffer space available. An operation on a socket could not be performed because the system lack...

socket passing between processes

Is there a way to pass a socket between processes (not same address space) in Windows? I find this info Shared Sockets, therefore believe that it is possible. "The WSADuplicateSocket function is introduced to enable socket sharing across processes"... More info : at source code of Apache (httpd-2.2.11-win32-src.zip) have usage for api...

More efficient way to reuse vector as array in winsock?

Hi, I'm currently using vectors as c-style arrays to send and recieve data through Winsock. I have a std::vector and I'm using that as my 'byte array'. The problem is, I'm using two vectors, one for each send, and one for each recv, but what I'm doing seems to be fairly inefficient. Example: std::string EndBody("\r\n.\r\n"); std::fil...

Is there a wide character version of WSABUF structure in "Microsoft Visual Studio 8\VC\PlatformSDK\Include\WinSock2"

Hi, Is there a wide character version of WSABUF structure in winsock? I want to write Japanese data on the socket. ...

problem with socket programming in c\c++

#include "stdafx.h" #include <windows.h> #include <winsock.h> #include <stdio.h> int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR IpCmdLine,int nCmdShow) { WSADATA ws; char buf[100]; WSAStartup(0x0101,&ws); sprintf(buf,"%d.%d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion)); MessageBox(0,buf,"info",0...

How to set up a Winsock UDP socket?

I want to create a Winsock UDP socket that only sends data to a client. I want the kernel to choose an available port for me. On the other hand, I want to indicate which local IP to use, since I'm running a few nics. I've tried combing through the maze of socket options, as well as binding with the port in the socket address set to 0 t...

How can I check if a client disconnected through Winsock in C++?

How can I check if a client disconnected through Winsock in C++? ...

Using Winsock and C to talk with an FTP server

How would I go about doing this? ...

debug vs release build in Visual studio c++ 2008 win32 runtime issue

I have a simple udp listener written in c++ using win32 when I compile and run the program under debug mode it works perfectly, and I'm clearly able to see the information from the packets that I'm receiving. When I run this same code as a release build it compiles fine and seems to run fine, but its not printing out any packet informati...

Windows networking using only Ethernet Frames

I'm doing a project where I must write a network library for a device connected to a Windows machine. The complication comes in that I may only communicate with the device using ethernet frames. So there is no TCP/UDP/IP at all. I don't think the bind/listen/accept approach can be applied here, but maybe I am wrong. Also, there is no ...

C++ Winsock API how to get connecting client IP before accepting the connection?

I am using the Winsock API (not CAsyncSocket) to make a socket that listens for incoming connections. When somebody tries to connect, how can I get their IP address BEFORE accepting the connection? I am trying to make it only accept connections from certain IP addresses. Thanks ...

How to receive ip multicast, using only one NIC

Hi, i have a problem here! I have server with multiple NICs, running windows server 2003. My application receive multicast packets, but now i need to receive multicast packets just from one single network interface. I think this can help, but i have some questions. ip_mreq mreq; mreq.imr_multiaddr.s_addr = multicast group address mr...