Fixed errors and removed unused code in the C client.
- Fixed a buffer overflow in sendCTRL. - Fixed incorrect inderection in readUDP. - Removed unused usleep function. - Removed redundant include of WS2tcpip.h - Fixed widespread error where sendUDP's return value was not being checked correctly. - Updated signature of openUDP to place optional parameters at the end - Fixed bug in CTRL command where the buffer length was not correctly set. - Fixed setCONN to correctlly reset the client's socket.
This commit is contained in:
@@ -39,21 +39,21 @@ extern "C" {
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char open;
|
||||
unsigned short port;
|
||||
|
||||
|
||||
// X-Plane IP and Port
|
||||
char xpIP[16];
|
||||
unsigned short xpPort;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _WIN32
|
||||
SOCKET sock;
|
||||
#else
|
||||
#else
|
||||
int sock;
|
||||
#endif
|
||||
#endif
|
||||
} XPCSocket;
|
||||
|
||||
typedef enum
|
||||
@@ -64,13 +64,14 @@ typedef enum
|
||||
} WYPT_OP;
|
||||
|
||||
// Low Level UDP Functions
|
||||
XPCSocket openUDP(unsigned short port, const char *xpIP, unsigned short xpPort);
|
||||
XPCSocket aopenUDP(const char *xpIP, unsigned short xpPort);
|
||||
XPCSocket openUDP(const char *xpIP, unsigned short xpPort, unsigned short port);
|
||||
void closeUDP(XPCSocket sock);
|
||||
int sendUDP(XPCSocket sock, char buffer[], int len);
|
||||
int readUDP(XPCSocket sock, char buffer[], int len, struct sockaddr* recvaddr);
|
||||
int readUDP(XPCSocket sock, char buffer[], int len);
|
||||
|
||||
// Configuration
|
||||
int setCONN(XPCSocket sock);
|
||||
int setCONN(XPCSocket* sock, unsigned short port);
|
||||
int pauseSim(XPCSocket sock, char pause);
|
||||
|
||||
// X-Plane UDP DATA
|
||||
|
||||
Reference in New Issue
Block a user