--- a/src/socket.cc
+++ b/src/socket.cc
@@ -24,10 +24,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <syslog.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <arpa/inet.h>		/* inet_addr */
 
 #include "socket.hh"
 
@@ -76,34 +78,41 @@
  * ListenSocket::ListenSocket():
  *   Start up the socket listening routines
  */
-ListenSocket::ListenSocket( int port )
+ListenSocket::ListenSocket( int port, char *bind_addr )
 {
 	int status;
-	struct sockaddr_in sin;
+	struct sockaddr_in s_in;
 	int one;
   
 	status = 0;
 	one = 1;
-	memset( &sin, 0, sizeof( sin ) );
-	sin.sin_family = AF_INET;
-	sin.sin_addr.s_addr = htonl( INADDR_ANY );
-	sin.sin_port = htons( port );
+	memset( &s_in, 0, sizeof( s_in ) );
+	s_in.sin_family = AF_INET;
+	s_in.sin_addr.s_addr = inet_addr( bind_addr );
+	s_in.sin_port = htons( port );
 
 	sock = socket( AF_INET, SOCK_STREAM, 0 );
  
 	if( sock==-1 )
 	{
+		syslog(LOG_ERR,"Error creating socket (%m)");
 		status = 1;
 	}
 
 	if( !status )
 	{
 		status = setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, (char*) &one, sizeof( one ) );
+		if(status)
+			syslog(LOG_ERR,"Error setting socket options (%m)");
 	}
-  
+
 	if( !status )
 	{
-		status = bind( sock, (struct sockaddr *) &sin, sizeof( sin ) );
+		status = bind( sock, (struct sockaddr *) &s_in, sizeof( s_in ) );
+		if(status)
+		{
+			syslog(LOG_ERR,"Error binding to port %d (%m)",port);
+		}
 	}	
 	if( !status )
 	{
@@ -143,7 +152,7 @@
  */
 int ListenSocket::newsock()
 {
-	int cSidLen;
+	unsigned int cSidLen;
 	int s;
 	
 	do
