diff --git a/src/socket_connection.c b/src/socket_connection.c index 0a70d2e39..ef568d032 100644 --- a/src/socket_connection.c +++ b/src/socket_connection.c @@ -430,7 +430,7 @@ void socket_connection_send_packet_all(uint16_t type, uint16_t channel, uint8_t /** * create socket connection to BTdaemon */ -connection_t * socket_connection_open_tcp(){ +connection_t * socket_connection_open_tcp(const char *address, uint16_t port){ // TCP struct protoent* tcp = getprotobyname("tcp"); @@ -441,8 +441,8 @@ connection_t * socket_connection_open_tcp(){ // localhost struct sockaddr_in btdaemon_address; btdaemon_address.sin_family = AF_INET; - btdaemon_address.sin_port = htons(BTSTACK_PORT); - struct hostent* localhost = gethostbyname("localhost"); + btdaemon_address.sin_port = htons(port); + struct hostent* localhost = gethostbyname(address); if(!localhost){ return NULL; } diff --git a/src/socket_connection.h b/src/socket_connection.h index c07d12f29..bdc763a01 100644 --- a/src/socket_connection.h +++ b/src/socket_connection.h @@ -63,7 +63,7 @@ int socket_connection_close_tcp(connection_t *connection); /** * create TCP socket connection to BTdaemon */ -connection_t * socket_connection_open_tcp(); +connection_t * socket_connection_open_tcp(const char *address, uint16_t port); /** * close TCP socket connection to BTdaemon