Hey I'm using the WSAEventSelect for event notifications of sockets. So far everything is cool and working like a charm, but there is one problem.
The client is a .NET application and the server is written in Winsock C++. In the .NET application I'm using System.Net.Sockets.Socket class for TCP/IP. When I call the Socket.Shutdown() and ...
Hi,
I'm having a problem where a TCP socket is listening on a port, and has been working perfectly for a very long time - it's handled multiple connections, and seems to work flawlessly. However, occasionally when calling accept() to create a new connection the accept() call fails, and I get the following error string from the system:
...
I'm sending messages over TCP/IP, I need to prefix message length in a char array and then send it. How do I do it?
Also can you please provide an example of how to extract it at the another end. And if possible, please explain.
I'm using C++ and Winsock.
EDIT:
string writeBuffer = "Hello";
unsigned __int32 length = htonl(writeBuffe...
I am developing some low-level stuff (LSP) and found out, that SMB traffic does not go through LSP, because SMB does not use Winsock. There is a paragraph in MSDN about it, but this is in part of MSDN dedicated to Windows CE. So, is there any comprehend list of whole traffic that does not go through Winsock? MSDN is bit messy about that....
I'm doing some fairly simple cross-platform TCP socket programming. I have unfortunately found out that when compiled on Windows, my sockets are non-blocking by default, while on OS X they are blocking by default. How do I force a socket into blocking mode on Windows? Do they normally default to non-blocking mode or is something terribly...
I'm using the WSAEventSelect I/O model in Windows Sockets and now I want to know that how may I know that my send and receive operations have sent and received all of the data?
After I know that, how should I design a way so that it sends the data fully? Any examples would be really appreciated.
Here is my code (not mine actually samp...
I am having an issue trying to communicate between a python TCP server and a c++ TCP client.
After the first call, which works fine, the subsequent calls cause issues.
As far as WinSock is concerned, the send() function worked properly, it returns the proper length and WSAGetLastError() does not return anything of significance.
Howeve...
I am trying to achieve peer to peer communication using winsock but gethostbyaddr always return me NULL ,this thing works only on localhost, server_name is destination ip address
server_name="<--ipaddress-->"
struct sockaddr_in server;
addr = inet_addr(server_name);
cout<<"inet_addr(server_name) "<<addr<<endl;
hp = gethostbyaddr((char...
I have python program which works perfectly for internet chatting. But program built on similar sockets in C++ do not work over internet.
Python program
import thread
import socket
class p2p:
def __init__(self):
socket.setdefaulttimeout(50)
self.port = 3000
#Destination IP HERE
self.peerId = '59.95.18.156'
...
Basically I have a header file like this:
#if WIN32
typedef DWORD (WSAAPI *SocketStartup) (WORD wVersionRequested, LPWSADATA lpWSAData);
typedef SOCKET (WINAPI *MakeSocket)(IN int af, IN int type, IN int protocol, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, IN GROUP g, IN DWORD dwFlags );
typedef DWORD (WINAPI *SocketSendFu...
I want to start thread in XPCOM Component.
Here is a code for creating thread
nsresult rv = NS_OK;
nsCOMPtr<Callback> obj = do_CreateInstance("@jscallback.p2psearch.com/f2f;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
char* str="Hello from C++";
_beginthread( (void(*)(nsCOMPtr<Callback> ))&P2P::test, 0,obj);
return NS_OK;/...
We have a client/server communication system over UDP setup in windows. The problem we are facing is that when the throughput grows, packets are getting dropped. We suspect that this is due to the UDP receive buffer which is continuously being polled causing the buffer to be blocked and dropping any incoming packets. Is it possible th...
Hi
I am creating a winsock UDP program. code i am using is shown below.
I am always getting port assignment error.
I am not able to understand why port always allocated is zero. If some can help me with this....
void UDPecho(const char *, const char *);
void errexit(const char *, ...);
#define LINELEN 128
#define WSVERS MAKEWORD(...
Hi,
I'm trying to use Winsock to download some files and save them.
In my case, I have a MSHFlexGrid with 2 columns: one with URL and the other with the "path+filename" (where the file is going to be saved).
I'm iterating through all rows calling the next function:
Public Function DownloadSock(ArqURL As String, ArqDestino As String) As...
I have a c++ program using winsock2. I would like to know how to tell when someone's connection to my program closes.
...
Hi,
It seems to be that the implementation required to set up a UDP multicast socket has changed between windows XP and windows vista. Specifically:
Under windows XP, you must call bind() before you can reference any multicast-specific socket options.
However, under windows vista, you must not call bind() when dealing with multicast s...
Lets say I have a server program that can accept connections from 10 (or more) different clients. The clients send data at random which is received by the server, but it is certain that at least one client will be sending data every update. The server cannot wait for information to arrive because it has other processing to do. Aside f...
hiho,
i intend to develop just a litte network application, something like a chat. so i downloaded xampp for windows and installed it (also as service), mysql included. well, i started the apache (and mysql) as service and just wrote the short line in java:
try {
Socket sock = new Socket("127.0.0.1", 21);
System.out.println...
What's an easiest reliable way to retrieve the fully qualified domain name of the current host in Win32?
I've tried calling gethostname(), but it returns a NetBIOS name.
...
Using my own program or others I can't get winsock to run when calling if the process is created with CreateProcessWithLogonW or CreateProcessAsUserW. It returns this error when I create the socket:
WSAEPROVIDERFAILEDINIT 10106
Service provider failed to initialize.
The requested service provider could not be loaded or initiali...