sio1blade windows crash fix;

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@90125 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\edgbla_cp 2014-04-24 16:51:45 +00:00
parent 9a7b4084da
commit dacb3c05e1
2 changed files with 18 additions and 8 deletions

View File

@ -47,7 +47,13 @@ static struct hostent *hostinfo;
/***************************************************************************/
s32 connectionOpen() {
int connectionOpen() {
#if defined _WINDOWS
WSADATA wsaData;
if(WSAStartup(0x202, &wsaData))
fprintf(stderr, "[SIO1] ERROR: WSAStartup()\n");
#endif
switch(settings.player) {
case PLAYER_MASTER: {
int reuse_addr = 1;
@ -120,12 +126,16 @@ void connectionClose() {
//close(serversock);
serversock = -1;
}
#if defined _WINDOWS
WSACleanup();
#endif
}
/***************************************************************************/
size_t connectionSend(u8 *pdata, s32 size) {
size_t bytes = 0;
int connectionSend(u8 *pdata, s32 size) {
int bytes = 0;
if(clientsock >= 0)
if((bytes = send(clientsock, (const char*)pdata, size, 0)) < 0)
@ -134,8 +144,8 @@ size_t connectionSend(u8 *pdata, s32 size) {
return bytes;
}
size_t connectionRecv(u8 *pdata, s32 size) {
size_t bytes = 0;
int connectionRecv(u8 *pdata, s32 size) {
int bytes = 0;
if(clientsock >= 0)
if((bytes = recv(clientsock, (char*)pdata, size, 0)) < 0)

View File

@ -22,13 +22,13 @@
/***************************************************************************/
extern s32 connectionOpen();
extern int connectionOpen();
extern void connectionClose();
/***************************************************************************/
extern size_t connectionSend(u8 *pdata, s32 size);
extern size_t connectionRecv(u8 *pdata, s32 size);
extern int connectionSend(u8 *pdata, s32 size);
extern int connectionRecv(u8 *pdata, s32 size);
/***************************************************************************/