Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srs_get_peer_ip retrieves the client's address. #1543

Closed
zxl8121 opened this issue Dec 26, 2019 · 2 comments
Closed

srs_get_peer_ip retrieves the client's address. #1543

zxl8121 opened this issue Dec 26, 2019 · 2 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@zxl8121
Copy link

zxl8121 commented Dec 26, 2019

Description'

Please ensure that the markdown structure is maintained.

Description'

Describe the problem you encountered.
The 'ip' inside 'on_play' is the local IP instead of the client player's IP.

Please ensure that the markdown structure is maintained.

Environment'

Please ensure that the markdown structure is maintained.

  1. SRS Version: srs3.0
  2. Operating System: centos7'

Please ensure that the markdown structure is maintained.

Solution:
Change getsockname to getpeername.

Please ensure that the markdown structure is maintained.

TRANS_BY_GPT3

@waiter89
Copy link

waiter89 commented Jan 1, 2020

I also encountered the same problem. After using getpeername, it returns 0.0.0.0. How can I solve this? The system I am using is openSUSE.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 5, 2020

Originally it was getpeername, later changed to getsockname: link

I checked the manual and confirmed that getpeername should indeed be used.

int getpeername(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
The getpeername() function returns the address of the peer connected to the specified socket.

int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
The getsockname() function returns the current address for the specified socket.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 5, 2021
@winlinvip winlinvip added the Bug It might be a bug. label Sep 5, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 6, 2021
@winlinvip winlinvip changed the title srs_get_peer_ip 获取客户端的地址 srs_get_peer_ip retrieves the client's address. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants