mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-06 15:56:26 +00:00
more cleanup
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
// Copyright (c) 2020 Anonymous275.
|
||||
// BeamMP Launcher code is not in the public domain and is not free software.
|
||||
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
|
||||
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
|
||||
///
|
||||
/// Created by Anonymous275 on 5/8/2020
|
||||
///
|
||||
#include "Zlib/Compressor.h"
|
||||
#include "Network/network.h"
|
||||
#include "Security/Enc.h"
|
||||
|
||||
#include <WS2tcpip.h>
|
||||
#include "Logger.h"
|
||||
#include <string>
|
||||
@@ -20,7 +24,7 @@ void UDPSend(std::string Data){
|
||||
}
|
||||
std::string Packet = char(ClientID+1) + std::string(":") + Data;
|
||||
int sendOk = sendto(UDPSock, Packet.c_str(), int(Packet.size()), 0, (sockaddr*)ToServer, sizeof(*ToServer));
|
||||
if (sendOk == SOCKET_ERROR)error(Sec("Error Code : ") + std::to_string(WSAGetLastError()));
|
||||
if (sendOk == SOCKET_ERROR)error("Error Code : " + std::to_string(WSAGetLastError()));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +55,7 @@ void UDPRcv(){
|
||||
void UDPClientMain(const std::string& IP,int Port){
|
||||
WSADATA data;
|
||||
if (WSAStartup(514, &data)){
|
||||
error(Sec("Can't start Winsock!"));
|
||||
error("Can't start Winsock!");
|
||||
return;
|
||||
}
|
||||
delete ToServer;
|
||||
@@ -60,6 +64,7 @@ void UDPClientMain(const std::string& IP,int Port){
|
||||
ToServer->sin_port = htons(Port);
|
||||
inet_pton(AF_INET, IP.c_str(), &ToServer->sin_addr);
|
||||
UDPSock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
GameSend("P"+std::to_string(ClientID));
|
||||
TCPSend("H",TCPSock);
|
||||
UDPSend("p");
|
||||
while(!Terminate)UDPRcv();
|
||||
|
||||
Reference in New Issue
Block a user