winsock

SSL api for winsock?

和自甴很熟 提交于 2019-12-29 09:11:50
问题 I have windows c++ project. Need to implement both ssl client and server on top of existing winsock code. I tried with openssl but it seems too messy. I assume there is nicer/shorter/cleaner/faster way implementeing this than openssl.. Im thankful for any suggestions.. 回答1: You can use Windows built-in SSL stuff -- SChannel . Searching Google fo "SChannel SSL" would give you plenty of information (though SChannel itself is poorly documented and not easy to comprehend). On the other hand,

SSL api for winsock?

…衆ロ難τιáo~ 提交于 2019-12-29 09:11:10
问题 I have windows c++ project. Need to implement both ssl client and server on top of existing winsock code. I tried with openssl but it seems too messy. I assume there is nicer/shorter/cleaner/faster way implementeing this than openssl.. Im thankful for any suggestions.. 回答1: You can use Windows built-in SSL stuff -- SChannel . Searching Google fo "SChannel SSL" would give you plenty of information (though SChannel itself is poorly documented and not easy to comprehend). On the other hand,

Tiny C Compiler (TCC) and winsock?

自作多情 提交于 2019-12-29 05:32:27
问题 Can I use a socket library from TCC? I can't find any reference to winsock or sys/socket.h in the include directory. If i remember correctly, winsock was part of the windows platform SDK (?) If so can I link that with TCC? 回答1: According to Tinycc-devel mailing list you should give this a try: tiny_impdef winsock.dll -o winsock.def tcc yourcode.c winsock.def -o yourcode.exe 回答2: Use tiny_impdef.exe to export definitions from the DLL file using the command line: tiny_impdef.exe wsock32.dll -o

how to create undefined number of threads and use WaitForMultipleObjects() in c on windows

跟風遠走 提交于 2019-12-25 18:36:28
问题 PS: I am very new to threads. I have a problem where i need to wait for connection requests(completely arbitrary number of times) from clients, accept a connection on a socket, create a worker thread after connection. The created thread then creates a char array, works on it and needs to pass it to the parent process. I have been able to create the threads in a while loop like while ((new_socket = accept(srv_sock, (struct sockaddr *)&client, &c)) != INVALID_SOCKET) { puts("\nConnection

Simple webserver won't work

折月煮酒 提交于 2019-12-25 16:38:14
问题 I'm trying to write a webserver in C. I know I could use many different libraries for that, but I want it to run only with winsock. The server and a client can send data back and forth but loading the webpage is impossible. Every time I get a 'server unreachable' message, but on the server I get the message that the body was sent. What am I doing wrong? edit I'm using chrome and microsoft edge #include <stdio.h> #include <conio.h> #include<winsock2.h> #pragma comment(lib,"ws2_32.lib") void

how to get an SDP record for bluetooth service?

和自甴很熟 提交于 2019-12-25 08:59:08
问题 I'm new to both winsock and bluetooth programming. I need to develop a bluetooth service to run on a pc. Looking at the MSDN library they say to use WSASetService(http://msdn.microsoft.com/en-us/library/aa362921%28VS.85%29.aspx) function to publish a service. The problem is that the WSAQUERYSET(http://msdn.microsoft.com/en-us/library/aa362920%28VS.85%29.aspx) structure, that has to be passed to WSASetService, needs a binary SDP record and i don't know how to get it. In the Windows embedded

C++ Winsock recv not blocking

拈花ヽ惹草 提交于 2019-12-25 08:56:58
问题 I'm devleoping a server in c++ and when im using recv() in a while loop it returns all the time length of -1 and also continue the loop without blocking. while(true) { char buffer[1024]; int dataLength = recv(socket, buffer, 1024, 0) cout << dataLength; } output: -1-1-1-1-1-1-1-1-1............. Anyone knows how to make this socket to block until it recievs data? Thanks in advance! 回答1: maybe there is an error during initilization try calling GetLastError() and printing the result after each

UDP WinSock - Not Receiving Broadcast Packets

拥有回忆 提交于 2019-12-25 08:38:16
问题 I'm testing a simple socket setup in which a server listens on a specified port, and a client sends a broadcast packet which should be received by that server. This setup works fine when sending messages directly (i.e. not broadcasting), but when broadcasting the packet is never received on the server. Some of the code (trimmed down with error checking removed, for simplicity): // Client (broadcast sender) // Create and bind the client socket clientSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO

Winsock accept() returning WSAENOTSOCK (code 10038)

一世执手 提交于 2019-12-25 07:48:27
问题 hope you're having a good day. Another socket issue, another day :) I finally got MicroSoft Visual C++ (MSVC++) IDE installed, plus the Platform SDK, so I can compile winsock applications. Missed a chunk of stuff here. In the ServerSocket::accept() function, it creates a new instance of ClientSocket and sets it's socket file descriptor to the one that was accept()ed, I have also checked there and it's recognizing that the descriptor is valid there as well. In my ClientSocket::recv() function,

Win32 error LNK2019: unresolved external symbol

无人久伴 提交于 2019-12-25 04:18:12
问题 I'm currently trying to learn WinSock coding from http://johnnie.jerrata.com/winsocktutorial/ however when I compile my listening socket, I get 9 error LNK2019: unresolved external symbol errors. They all look to be the same function names that are used in the code prefixed with an underscore after the function name it says referenced in function _WinMain@16 This also happens when I run the code example that is available for download, so I don't think I've made a mistake. What is an