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

Laboratorul 10, exercitiul cu sender-reciever. #46

Open
sqeedward opened this issue Dec 19, 2023 · 3 comments
Open

Laboratorul 10, exercitiul cu sender-reciever. #46

sqeedward opened this issue Dec 19, 2023 · 3 comments
Labels
topic/io Related to "Input/Output" chapter

Comments

@sqeedward
Copy link

Pe scheletul de cod cand rezolvam exercitiul, primul mesaj va fi mereu: Received from IP 0.0.0.0 and port 0: "mesajul". Isi revine ulterior dupa primul input.
Screenshot 2023-12-19 114415

@gabrielmocanu
Copy link
Member

Hi @sqeedward

It seems like there might be an issue with the sender_addr_len variable. In the recvfrom function, you are passing the address of sender_addr_len to store the size of the sender's address. However, it looks like that sender_addr_len variable is not initialized before calling recvfrom. This could lead to unpredictable behavior and might be the reason why you are not getting the correct IP address.

To fix this issue, you should initialize sender_addr_len before using it. Add the following line before the recvfrom function:

sender_addr_len = sizeof(sender_addr);

Can you do this fix, please?

@gabrielmocanu
Copy link
Member

I assigned this issue to @Alex-deVis since he is the owner of the code.
He might help you. Otherwise, @Alex-deVis , please make sure we have a fix for this problem.

@Alex-deVis
Copy link

I'll pass this to @andreia-oca since this might be reused as a demo for GitHub operations.

@Alex-deVis Alex-deVis assigned andreia-oca and unassigned Alex-deVis Oct 21, 2024
@Alex-deVis Alex-deVis added the topic/io Related to "Input/Output" chapter label Oct 21, 2024
@andreia-oca andreia-oca removed their assignment Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/io Related to "Input/Output" chapter
Projects
None yet
Development

No branches or pull requests

4 participants