winsock

C++ - sending a modified file periodically

旧时模样 提交于 2019-12-25 03:34:59
问题 I want to send a file periodically from client to server in C++. say, every 10 seconds. send.txt is the file that i want to send to server through socket send.txt contains "123456" for the first 10 seconds. i change the file content by adding 78910 11 12 so it becomes "123456 78910 11 12" the server should receive "123456 78910 11 12" for the next 10 seconds. but the problem is the file that i received is still the original one (123456) and look like it never changes. here is my client code :

C# sockaddr to sockaddr_in

荒凉一梦 提交于 2019-12-25 03:14:13
问题 I am writing an application in C# that hooks the connect function call of another program and reads the IP it is connecting to. (I know it is IPv4) Currently it hooks, intercepts and forwards the function call and I get the variables but since connect in winsock is called with a sockaddr* variable as the second argument, I need cast this to a sockaddr_in to get the IP address. (Unless there is a way to retrieve the ip out of the sa_data field, which I couldn't find information about.) This is

How can I trigger a WSAOVERLAPPED event? (C++)

非 Y 不嫁゛ 提交于 2019-12-25 02:40:57
问题 Note: The particular case I'm having troubles with is when lpCompletionRoutine is null and lpOverlapped is not. I'm trying to write a packet sniffer. I'm hooking WSARecv and replacing it with my own code. If lpOverlapped is not null, I create my own LPWSAOVERLAPPED variable and call the real WSARecv. I receive and log the packet just fine, but the problem is, the client that I'm sniffing seems to wait for it's WSAOVERLAPPED thing to be triggered. So the question is, how do I trigger the

400 bad request error when send a GET http request by using winsock library

倾然丶 夕夏残阳落幕 提交于 2019-12-24 19:29:37
问题 I'm trying to send a GET request to a webserver(example: www.coursera.org,...). But sServer returns a response header: HTTP/1.1 400 bad request I used Winsock in C++ and establish a socket connect to server. Then, send a GET request to server. int main(void) { get_Website("www.coursera.org"); cout << website_HTML; cout << "\n\nPress ANY key to close.\n\n"; cin.ignore(); cin.get(); return 0; } void get_Website(string url) { WSADATA wsaData; SOCKET Socket; SOCKADDR_IN SockAddr; int lineCount =

IO Completion ports: separate thread pool to process the dequeued packets?

爷,独闯天下 提交于 2019-12-24 18:41:41
问题 NOTE : I have added the C++ tag to this because a) the code is C++ and b) people using C++ may well have used IO completion ports. So please don't shout. I am playing with IO completion ports, and have eventually fully understood (and tested, to prove) - both with help from RbMm - the meaning of the NumberOfConcurrentThreads parameter within CreateIoCompletionPort() . I have the following small program which creates 10 threads all waiting on the completion port. I tell my completion port to

My client/server program created in vb6(winsock) dont work on WAN but perfectly works n LAN Why?

只愿长相守 提交于 2019-12-24 12:55:14
问题 I've created a simple client/server program with the help of winsock in vb6. It perfectly works on LAN but the problem is it doesn't work on WAN. All ports are already open, Firewall is already Off, I have dynamic IP so I used No-ip to get named IP address. One more think I want to ask is , is it important to open port on both client and server? For eg- I've created the program on port 50505 and on the client computer the port is open but is it important to open 50505 on server also?? Here is

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

柔情痞子 提交于 2019-12-24 10:59:07
问题 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 write to the socket again. It seems my program hangs if I do not use shutdown() (on SD_SEND) after I send the initial buffer. So the next data (based on RFC 1459) I want

simple tcp echo program not working when SDL included?

我们两清 提交于 2019-12-24 10:56:48
问题 I have this weird problem where whenever I #include "SDL/SDL.h" , my windows socket program doesn't execute. It compiles but it doesn't do anything when run. When I remove the #include "SDL/SDL.h" header, compile and run, it starts working again??. I'm trying to make both SDL and my original socket program work but I don't understand whats wrong this. //#include "SDL/SDL.h" #define _WIN32_WINNT 0x501 #include <iostream> #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #include

Does changing this one line implement persistent keep-alive connections?

ぃ、小莉子 提交于 2019-12-24 08:39:22
问题 After the appropriate initializations, here's an infinite loop to service incoming HTTPS requests, but only one connection per request (and assuming requests need only one read): while TRUE do begin // wait for incoming TCP connection if listen(listen_socket, 100) 0 then continue; // listen failed client_len := SizeOf(sa_cli); sock := accept(listen_socket, @sa_cli, @client_len); // create socket for connection if sock = INVALID_SOCKET then continue; // accept failed ssl := SSL_new(ctx); //

Send string from VB6 Winsock to WebSockets

我的梦境 提交于 2019-12-24 07:19:42
问题 I'm Making a VB6 application that connected to WebSocket , the Handshaking and reserving data part is working as i need and , currently i'm stucked at the Sending a string back to Websocket via Winsock, i'm referring this blog post to work with websocket handshaking and things VB6 + Winsock prepared websocket server I have tried like this Private Declare Sub CopyMemory _ Lib "kernel32" _ Alias "RtlMoveMemory" (Destination As Any, _ Source As Any, _ ByVal Length As Long) ______________________