Questions tagged [winsock2]

Windows Sockets 2 (Winsock) enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used

964 questions
-2
votes
1 answer

C++ error: undefined reference to (winsock2.h)

I am trying to compile following socket server in windows making use of the library winsock2.h. in clion v3.8 #include #include using namespace std; int main() { WSADATA WSAData; SOCKET server, client; SOCKADDR_IN…
Yılmaz edis
  • 146
  • 3
  • 13
-2
votes
1 answer

Get the real size of received packet

Usually when sending arbitrarily sized packets, a maximum is established and used as the size of your receive buffer. #include // Socket Description // Hint.ai_family = AF_INET; // Hint.ai_socktype = SOCK_DGRAM; // Hint.ai_protocol =…
KKlouzal
  • 732
  • 9
  • 32
-2
votes
1 answer

Program crashes when trying to retrieve contents of pointer

I'm making a socket program in C++ using winsock2 and I'm trying to use WSAAccept to conditionally accept connections. I copied the example ConditionalFunction from MSDN for the lpfnCondition argument in WSAAccept as seen below. SOCKET WSAAccept( …
John Doe
  • 120
  • 8
-2
votes
1 answer

C++ Winsock recv hook Detours

i want to write a .dll. My Targetapplication is a Game and use winsock. The .dll should write all things in a Console what the Game (Targetapplication) recives through the recv function in winsock. I've created a C++ Win32 Console Application in…
prophet
  • 3
  • 1
  • 2
-2
votes
1 answer

Connecing to server by MAC winsock2

i am working on a remote control program so i need to create connecting to the server(the remote pc) by MAC address (i cant go by ip because he is behind NAT)
ErikNa
  • 1
  • 2
-2
votes
2 answers

C++ winsock send arrays

I'm trying to send arrays trough the net with winsock2. Now, i read microsoft disabled sending raw pointers, but you can still send un-edited binary data by casting the pointer to char*: send(rsock, (char*)&counter, len, 0); However, the problem is…
Alex
  • 45
  • 1
  • 7
-2
votes
1 answer

windows sdk and wsa startup

i'm new to network programming and i am trying out a tutorial on . here's the program i tried. #include #include #include #include using namespace std; int main() { WSADATA wsaData; int…
-2
votes
1 answer

Socket application not work properly

I trying to write a small code to send a file over network on Windows, but it seem not work properly. This is my code: char *arrFile = readFile("test.exe"); int fileSize = getFileSize("test.exe"); int sentSize = 0; int justSent; while(sentSize <…
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
-3
votes
1 answer

Chat Client Server across the network using Winsocket 2 and C++?

I am Developing a chat system that consists of multiple clients and a server. The clients should discover the server by sending a broadcast message, which the server will respond to, sending back to the client it's IP and port. The problem is when I…
-3
votes
1 answer

Is there any limit of data while tcp transfering between Client-server?

I want to transfer 32k data between client-server with WinSock2. Is it possible or there is a limitation with data?
Mehmet Özcan
  • 85
  • 1
  • 5
-3
votes
1 answer

Winsock connect call crashing if multiple threads running, works fine in one thread?

I have an application that needs to download a variable list of files (changes based on user, what's changed, etc). The list can be very short or very long (1000's of files). I start X worker threads with a list for each thread to download. If I…
Bret Levy
  • 27
  • 1
  • 4
-3
votes
1 answer

Combine TCP and UDP in C++ winsock server

I'm now facing the problem of C++ winsock server programming for receiving messages from both TCP and UDP. In fact, UDP is used for receiving the job message from another server, while TCP receives messages from multiple RFID receivers. So I've…
mckingwan
  • 3
  • 6
-3
votes
1 answer

c++ post request command winsock

I know c++ windows socket and i can connect to HTTP server. *why at every command sent to the server i must use "/r/n" at the end?* I want to fill forms (boxes) in HTTP site. I heard u can do this with post request, how to do that in c++ using…
John Smith
  • 13
  • 1
-4
votes
1 answer

Can I use std::string in IOCP WSARecv func?

I tried to use std::string in WSARecv (winsock), but it didnt work, can you tell me if it's possibleand and how it works
Vlaidslav
  • 13
  • 1
-4
votes
1 answer

SOCKET in winsock2.h not accepted in visual studio 2017

Getting error i freetds headers when i include them in my VS 2017 c++ project in tds.h when i include that in my project include\tds.h(1331): error C3646: 's': unknown override specifier include\tds.h(1331): error C4430: missing type…
1 2 3
64
65