winsock2

How can i ping remote computer on my Windows computer with c++?

我怕爱的太早我们不能终老 提交于 2021-02-20 03:55:11
问题 I used below code. It works, but in debug mode in Visual Studio if you stop the debug the computer gave blue screen so it is not useful. I did some research and i found this is a common bug for icmpapi. Is there a any way to ping computer c++? #include <winsock2.h> #include <iphlpapi.h> #include <icmpapi.h> //Declare and initialize variables HANDLE hIcmpFile; unsigned long ipaddr = INADDR_NONE; DWORD dwRetVal = 0; DWORD dwError = 0; char SendData[] = "Data Buffer"; LPVOID ReplyBuffer = NULL;

SSL_WRITE is merging messages when sent in different functions for TLS over TCP [duplicate]

我们两清 提交于 2020-12-27 06:09:50
问题 This question already has answers here : What is a message boundary? (2 answers) Is there any way to flush the SSL write buffer (2 answers) Closed last month . I am writing a client to send data to remote server. I am 3 different messages (hello, hello1, hello2) using SSL_WRITE , but in server I can see only single message is sent like this: hellohello1hello2 . Can someone please help what am I missing here, why separate hello, hello1 and hello2 messages are not sent but a string

SSL_WRITE is merging messages when sent in different functions for TLS over TCP [duplicate]

人盡茶涼 提交于 2020-12-27 06:07:14
问题 This question already has answers here : What is a message boundary? (2 answers) Is there any way to flush the SSL write buffer (2 answers) Closed last month . I am writing a client to send data to remote server. I am 3 different messages (hello, hello1, hello2) using SSL_WRITE , but in server I can see only single message is sent like this: hellohello1hello2 . Can someone please help what am I missing here, why separate hello, hello1 and hello2 messages are not sent but a string

SSL_WRITE is merging messages when sent in different functions for TLS over TCP [duplicate]

耗尽温柔 提交于 2020-12-27 06:07:13
问题 This question already has answers here : What is a message boundary? (2 answers) Is there any way to flush the SSL write buffer (2 answers) Closed last month . I am writing a client to send data to remote server. I am 3 different messages (hello, hello1, hello2) using SSL_WRITE , but in server I can see only single message is sent like this: hellohello1hello2 . Can someone please help what am I missing here, why separate hello, hello1 and hello2 messages are not sent but a string

SSL_WRITE is merging messages when sent in different functions for TLS over TCP [duplicate]

淺唱寂寞╮ 提交于 2020-12-27 06:06:59
问题 This question already has answers here : What is a message boundary? (2 answers) Is there any way to flush the SSL write buffer (2 answers) Closed last month . I am writing a client to send data to remote server. I am 3 different messages (hello, hello1, hello2) using SSL_WRITE , but in server I can see only single message is sent like this: hellohello1hello2 . Can someone please help what am I missing here, why separate hello, hello1 and hello2 messages are not sent but a string

SChannel/SSL implementation?

帅比萌擦擦* 提交于 2020-06-25 17:24:10
问题 I can implement HTTP using "win sockets" easily , but I've been struggling to implement HTTPS using "SChannel" which is pretty much poorly documented "at least for me". How can I establish a secure connection for HTTPS communication and is there any security or performance considerations I should be aware of? 回答1: SChannel integrated quite well with Windows and allows you to perform authentication without asking the user's credentials. Schannel works on a lower level than HTTP. It allows you

SChannel/SSL implementation?

ε祈祈猫儿з 提交于 2020-06-25 17:21:51
问题 I can implement HTTP using "win sockets" easily , but I've been struggling to implement HTTPS using "SChannel" which is pretty much poorly documented "at least for me". How can I establish a secure connection for HTTPS communication and is there any security or performance considerations I should be aware of? 回答1: SChannel integrated quite well with Windows and allows you to perform authentication without asking the user's credentials. Schannel works on a lower level than HTTP. It allows you

C Sockets: recv() blocks when all data is downloaded [duplicate]

别说谁变了你拦得住时间么 提交于 2020-06-01 07:36:26
问题 This question already has an answer here : Differ between header and content of http server response (sockets) (1 answer) Closed 2 years ago . I'm writing a wrapper for Berkley sockets on Windows and Linux. The test program got problem here: char buf[BUFSIZE]; int res = 0; while((res = NetRecv(sock, buf, BUFSIZE, 0)) > 0) // 'NetRecv' is pointing to 'recv' { buf[res-1] = '\0'; printf("%s", buf); } The response is to a HTTP-Get request of a web-page content. The socket is streaming. The '

Wrapping Winsock functions in C++ classes

点点圈 提交于 2020-02-29 05:25:28
问题 I've seen some people creating a "is-a" relationship like the following: class TCPClient : public Socket { public: TCPClient(const std::string& host, unsigned short port); }; where the Socket class implements Winsock functions such as Connect(), Close(), Bind() etc. Examples : Example 1 Example 2 But this doesn't feel natural to me who is a newbie in socket programming. Does the above hierarchy make more logical sense than the following "has-a" counterpart? class TCPClient { public: TCPClient

ws2_32.lib vs. libws2_32.a, what's the difference and how to link libws2_32 to NB project?

一世执手 提交于 2020-01-13 06:58:11
问题 I use NetBeans, Windows and Cygwin with g++ compiler. I'm examining Windows Sockets 2. I do everything that is written in MS manual. I have a code (mostly from this manual): #include <winsock2.h> #include <ws2tcpip.h> #include <cstdlib> #include <iostream> #pragma comment(lib, "Ws2_32.lib") int main() { WSADATA wsaData; int iResult; // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); return 1; } else cout <<