Skip to content

Commit

Permalink
WinIPBroadcast version 1.2 import.
Browse files Browse the repository at this point in the history
  • Loading branch information
dechamps committed Jul 6, 2013
1 parent 7b99dc5 commit d00cf35
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.2 (15/11/2009)
- Forgot to close a socket when sending broadcasts, which could cause serious problems on the system (e.g. total freezes) when sending large numbers of broadcast packets.

1.1 (31/10/2009)
- Handle WSAEHOSTUNREACH correctly in broadcastRouteAddress(). Allows WinIPBroadcast to survive waking from sleep.

Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
README
WinIPBroadcast 1.1
WinIPBroadcast 1.2
By e-t172 <[email protected]>
http://winipbroadcast.e-t172.net/

Expand Down
8 changes: 4 additions & 4 deletions installer.iss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[Setup]
AppID=WinIPBroadcast
AppName=WinIPBroadcast
AppVerName=WinIPBroadcast 1.1
AppVersion=1.1
AppVerName=WinIPBroadcast 1.2
AppVersion=1.2
AppPublisher=e-t172
AppPublisherURL=http://winipbroadcast.e-t172.net/
AppSupportURL=http://winipbroadcast.e-t172.net/
AppUpdatesURL=http://winipbroadcast.e-t172.net/
AppContact=[email protected]

OutputDir=.
OutputBaseFilename=WinIPBroadcast-1.1
OutputBaseFilename=WinIPBroadcast-1.2

DefaultDirName={pf}\WinIPBroadcast
AppendDefaultDirName=no
Expand All @@ -27,7 +27,7 @@ Source:"README.txt"; DestDir:"{app}"; Flags: ignoreversion isreadme
[Registry]
Root: HKLM; Subkey: "SOFTWARE\WinIPBroadcast"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\WinIPBroadcast"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: deletevalue
Root: HKLM; Subkey: "SOFTWARE\WinIPBroadcast"; ValueType: string; ValueName: "Version"; ValueData: "1.0"; Flags: deletevalue
Root: HKLM; Subkey: "SOFTWARE\WinIPBroadcast"; ValueType: string; ValueName: "Version"; ValueData: "1.2"; Flags: deletevalue

[Run]
Filename: "{app}\WinIPBroadcast.exe"; Parameters: "install"; StatusMsg: "Installing service..."; Flags: runhidden
Expand Down
9 changes: 6 additions & 3 deletions src/WinIPBroadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ void sendBroadcast(ULONG srcAddress, char *payload, DWORD payloadSize)
if (listenSocket == INVALID_SOCKET)
{
socketError(TEXT("WSASocket"), FALSE);
closesocket(socket);
return;
}

block = 0;
if (WSAIoctl(socket, FIONBIO, &block, sizeof(block), NULL, 0, &len, NULL, NULL) == SOCKET_ERROR)
{
socketError(TEXT("WSAIoctl(FIONBIO)"), FALSE);
closesocket(socket);
return;
}

Expand All @@ -239,13 +241,15 @@ void sendBroadcast(ULONG srcAddress, char *payload, DWORD payloadSize)
if (bind(socket, (SOCKADDR *)&srcAddr, sizeof(srcAddr)) == SOCKET_ERROR)
{
socketError(TEXT("bind"), FALSE);
closesocket(socket);
return;
}

broadcastOpt = TRUE;
if (setsockopt(socket, SOL_SOCKET, SO_BROADCAST, (char *)&broadcastOpt, sizeof(broadcastOpt)) == SOCKET_ERROR)
{
socketError(TEXT("setsockopt(SO_BROADCAST)"), FALSE);
closesocket(socket);
return;
}

Expand All @@ -260,10 +264,9 @@ void sendBroadcast(ULONG srcAddress, char *payload, DWORD payloadSize)

if (WSASendTo(socket, &wsaBuffer, 1, &len, 0, (SOCKADDR *)&dstAddr, sizeof(dstAddr), NULL, NULL) != 0)
if (WSAGetLastError() != WSAEWOULDBLOCK)
{
socketError(TEXT("WSASend"), FALSE);
return;
}

closesocket(socket);
}

void relayBroadcast(char *payload, DWORD payloadSize, ULONG srcAddress)
Expand Down

0 comments on commit d00cf35

Please sign in to comment.