Category : tcp

// client.h #pragma once #pragma comment(lib, "ws2_32.lib") #define _WINSOCK_DEPRECATED_NO_WARNINGS #define PORT 8080 #define PACKET_SIZE 1024 #include <iostream> #include <winsock2.h> #include <windows.h> #include <thread> //thread #include <cstdlib> //strcpy_s #include <string> //getline #include <windows.h> // server.h #pragma once #pragma comment(lib, "ws2_32.lib") #define PORT 8080 #define PACKET_SIZE 1024 #include <iostream> // c++ stadard input output #include <winsock2.h> // ..

Read more

I am trying to implement TCP client-server communication. Where if server any how restarted(or disconnected) then client must reconnect to the server itself and start receiving data itself Here is my Server code #include<iostream> #include<string.h> #include<sys/socket.h> #include<unistd.h> #include<sys/types.h> #include<netinet/in.h> #include<arpa/inet.h> using namespace std; #define PORT 5555 int main(){ int sockfd; struct sockaddr_in serverAddr; int newSocket; ..

Read more

I am currently writing a testing/simulation software that shall imitate a certain behavior of a communication client using a proprietary TCP/IP protocol. To simulate a broken connection I want to just kick an open client socket out of the list. After some research I found that the SetTcpEntry method from the iphlpapi is a candidate ..

Read more

I am using a windows machine[my client]. I want a method[tool/command/script] to create "Half-close" TCP connections to an endpoint [say server abc.com]. Half close Definition I am using: 1.The windows client should timeout and close, but the abc.com server still does not close. But TCP handshake should have already happened. 2.Client sends FIN. Sever sends ..

Read more

I’m working with QTcpServer and QTcpSocket for making a server on the other side there is a client written in C, which calls shutdown(socket, SD_SEND); after writing request, so it only expects data from server. /* * WinSock 2 extension — manifest constants for shutdown() */ #define SD_RECEIVE 0x00 #define SD_SEND 0x01 #define SD_BOTH 0x02 ..

Read more