1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-16 00:34:19 +00:00

Fix for win32 sockets.

This commit is contained in:
Julian Storer 2011-03-01 21:26:07 +00:00
parent 2a6c8af928
commit 19c6d9d2bc
4 changed files with 24 additions and 16 deletions

View file

@ -307,8 +307,8 @@ public:
speakerOut (kSpeakerArrEmpty),
numInChans (JucePlugin_MaxNumInputChannels),
numOutChans (JucePlugin_MaxNumOutputChannels),
isProcessing (false)
hasShutdown (false)
isProcessing (false),
hasShutdown (false),
firstProcessCallback (true),
shouldDeleteEditor (false),
hostWindow (0)

View file

@ -519,6 +519,7 @@
#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <ws2tcpip.h>
#include <shellapi.h>
#include <mmsystem.h>
#include <vfw.h>
@ -9187,34 +9188,37 @@ namespace SocketHelpers
zerostruct (hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = isDatagram ? SOCK_DGRAM : SOCK_STREAM;
hints.ai_flags = AI_NUMERICSERV;
struct addrinfo* result = 0;
if (getaddrinfo (hostName.toUTF8(), 0, &hints, &result) != 0 || result == 0)
struct addrinfo* info = 0;
if (getaddrinfo (hostName.toUTF8(), String (portNumber).toUTF8(), &hints, &info) != 0 || info == 0)
return false;
if (handle < 0)
handle = (int) socket (result->ai_family, result->ai_socktype, 0);
handle = (int) socket (info->ai_family, info->ai_socktype, 0);
if (handle < 0)
{
freeaddrinfo (result);
freeaddrinfo (info);
return false;
}
if (isDatagram)
{
struct sockaddr* s = new struct sockaddr();
*s = *(result->ai_addr);
*s = *(info->ai_addr);
*serverAddress = s;
freeaddrinfo (result);
freeaddrinfo (info);
return true;
}
freeaddrinfo (result);
freeaddrinfo (info);
setSocketBlockingState (handle, false);
const int result = ::connect (handle, info->ai_addr, info->ai_addrlen);
if (result < 0)
{
#if JUCE_WINDOWS

View file

@ -258,34 +258,37 @@ namespace SocketHelpers
zerostruct (hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = isDatagram ? SOCK_DGRAM : SOCK_STREAM;
hints.ai_flags = AI_NUMERICSERV;
struct addrinfo* result = 0;
if (getaddrinfo (hostName.toUTF8(), 0, &hints, &result) != 0 || result == 0)
struct addrinfo* info = 0;
if (getaddrinfo (hostName.toUTF8(), String (portNumber).toUTF8(), &hints, &info) != 0 || info == 0)
return false;
if (handle < 0)
handle = (int) socket (result->ai_family, result->ai_socktype, 0);
handle = (int) socket (info->ai_family, info->ai_socktype, 0);
if (handle < 0)
{
freeaddrinfo (result);
freeaddrinfo (info);
return false;
}
if (isDatagram)
{
struct sockaddr* s = new struct sockaddr();
*s = *(result->ai_addr);
*s = *(info->ai_addr);
*serverAddress = s;
freeaddrinfo (result);
freeaddrinfo (info);
return true;
}
freeaddrinfo (result);
freeaddrinfo (info);
setSocketBlockingState (handle, false);
const int result = ::connect (handle, info->ai_addr, info->ai_addrlen);
if (result < 0)
{
#if JUCE_WINDOWS

View file

@ -54,6 +54,7 @@
#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <ws2tcpip.h>
#include <shellapi.h>
#include <mmsystem.h>
#include <vfw.h>