1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Allow changing tracy port in client.

This commit is contained in:
Bartosz Taudul
2019-09-21 15:11:15 +02:00
parent 140654961c
commit e13cbf52fd
3 changed files with 21 additions and 9 deletions
+10 -4
View File
@@ -279,7 +279,7 @@ ListenSocket::~ListenSocket()
if( m_sock != -1 ) Close();
}
bool ListenSocket::Listen( const char* port, int backlog )
bool ListenSocket::Listen( int port, int backlog )
{
assert( m_sock == -1 );
@@ -291,7 +291,10 @@ bool ListenSocket::Listen( const char* port, int backlog )
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
if( getaddrinfo( nullptr, port, &hints, &res ) != 0 ) return false;
char portbuf[32];
sprintf( portbuf, "%i", port );
if( getaddrinfo( nullptr, portbuf, &hints, &res ) != 0 ) return false;
m_sock = socket( res->ai_family, res->ai_socktype, res->ai_protocol );
#if defined _WIN32 || defined __CYGWIN__
@@ -359,7 +362,7 @@ UdpBroadcast::~UdpBroadcast()
if( m_sock != -1 ) Close();
}
bool UdpBroadcast::Open( const char* addr, const char* port )
bool UdpBroadcast::Open( const char* addr, int port )
{
assert( m_sock == -1 );
@@ -370,7 +373,10 @@ bool UdpBroadcast::Open( const char* addr, const char* port )
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
if( getaddrinfo( addr, port, &hints, &res ) != 0 ) return false;
char portbuf[32];
sprintf( portbuf, "%i", port );
if( getaddrinfo( addr, portbuf, &hints, &res ) != 0 ) return false;
int sock = 0;
for( ptr = res; ptr; ptr = ptr->ai_next )
{