Add the ability to bind listening sockets to addresses, and use this for the

/detach IPC socket.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@330 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-08-15 14:05:15 +00:00
parent a394019490
commit 176be1cff2
2 changed files with 6 additions and 2 deletions

View File

@@ -2576,7 +2576,7 @@ static int create_ipc_socket(void)
init_socketpath();
if ((s = connect_by_number(NULL, &port, SERVICE_SERVER, PROTOCOL_TCP, 0)) < 0)
if ((s = connect_by_number("127.0.0.1", &port, SERVICE_SERVER, PROTOCOL_TCP, 0)) < 0)
{
bitchsay("Error creating IPC socket: [%d] %s", s, strerror(errno));
return 1;

View File

@@ -466,6 +466,10 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int
memset(&name, 0, sizeof name);
name.sin_family = AF_INET;
if (hostn)
inet_aton(hostn, &name.sin_addr);
else
name.sin_addr.s_addr = htonl(INADDR_ANY);
name.sin_port = htons(*portnum);