Browse Source

Fix for win32 sockets.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
19c6d9d2bc
4 changed files with 24 additions and 16 deletions
  1. +2
    -2
      extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp
  2. +11
    -7
      juce_amalgamated.cpp
  3. +10
    -7
      src/io/network/juce_Socket.cpp
  4. +1
    -0
      src/native/windows/juce_win32_NativeIncludes.h

+ 2
- 2
extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp 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)


+ 11
- 7
juce_amalgamated.cpp 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


+ 10
- 7
src/io/network/juce_Socket.cpp 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


+ 1
- 0
src/native/windows/juce_win32_NativeIncludes.h 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>


Loading…
Cancel
Save