mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine wiki, cluster to forward.
This commit is contained in:
parent
b15ee26a48
commit
08bc34e0df
3 changed files with 28 additions and 7 deletions
|
@ -993,6 +993,25 @@ string srs_get_local_ip(int fd)
|
|||
return ip;
|
||||
}
|
||||
|
||||
int srs_get_local_port(int fd)
|
||||
{
|
||||
std::string ip;
|
||||
|
||||
// discovery client information
|
||||
sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
if (getsockname(fd, (sockaddr*)&addr, &addrlen) == -1) {
|
||||
return 0;
|
||||
}
|
||||
srs_verbose("get local ip success.");
|
||||
|
||||
int port = ntohs(addr.sin_port);
|
||||
|
||||
srs_verbose("get local ip of client port=%s, fd=%d", port, fd);
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
string srs_get_peer_ip(int fd)
|
||||
{
|
||||
std::string ip;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue