It's UWAweek 20 (1st semester, week 11)

help3002

This forum is provided to promote discussion amongst students enrolled in CITS3002 Computer Networks.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message. How do I ask a good question?

Chris is away until 4th June. Dr Atif Mansoor is the unit's coordinator until then.
Displaying the 5 articles in this topic
Showing 5 of 443 articles.
Currently 1 other person reading this forum.


 UWA week 18 (1st semester, week 9) ↓
SVG not supported

Login to reply

👍?
helpful

Hello, I'm doing the C implementation of the project in WSL2, and I'm up to the part where the stations start communicating between different computers. I have a desktop computer and a laptop, both at home on the same router. I'm having an issue where the laptop's packets won't go through. Weirdly, packets can make a round trip when going desktop->laptop->desktop (e.g. a query starts at a desktop station, which then tries to ask a laptop station for information), but the packets won't go laptop->desktop when a query starts at the laptop. Also, the packets from the desktop are on a different port to what I expect. For example, if a desktop station has the port 4001 and sends something to a laptop station, I would expect that the laptop station receives a message from the desktop's IP with port 4001. Instead, it receives messages from a random port that no other station owns. How do I get this working? I've searched online, but there seems to be so many things that might be happening and I don't know where to start. I tried disabling the firewall on both computers, but that didn't change anything. Maybe someone else has the same problem and has a solution? Thanks


 UWA week 19 (1st semester, week 10) ↓
SVG not supported

Login to reply

👍?
helpful

ANONYMOUS wrote:
> .... Instead, it receives messages from a random port that no other station owns.
Always difficult to diagnose, but is the receiver converting the port from network-standard-order to host-order before displaying and re-using it?


SVG not supported

Login to reply

👍?
helpful

I realised that the address printing function was using htons() instead of ntohs(). I changed it, but the ports were still printing unexpected ports. The random ports only appear from outside traffic, and are the same for the duration of the station instance's lifetime. Regardless, the address printing has no effect on the actual sending/receiving, because I just save the address from recvfrom() or getaddrinfo() and reuse that when responses are sent, without changing any data inside. Address printing is just for debugging. Another thing I found is that my laptop was using Ubuntu 20.04 with WSL version 1, while the desktop PC was using "Ubuntu" on WSL version 2 (no Ubuntu version is specified, but "cat /etc/os-release" tells me it's 22.04). I set up Ubuntu 22.04 with WSL 2 on both the laptop and the desktop, and now neither computers' data goes through to each other. The desktop stations can still talk to each other, and the the desktop's browser can talk to the stations. Same thing for the laptop. But the devices can't communicate with each other in any way. I'm not sure what to make of this. I think maybe WSL 2 doesn't let traffic through by default, and I have to make a firewall rule? I don't know how to though. Any help is appreciated. Thanks


SVG not supported

Login to reply

👍?
helpful

After some more reading here: https://learn.microsoft.com/en-us/windows/wsl/networking I was sort of right when I said I need to enable some firewall setting. WSL1 lets you do networking out of the box, but WSL2 requires you to port-forward your desired ports. It looks like I have to connect each station to each neighbour manually. For example, if I have a network with 2 stations with ports 4002 and 4004, I have to make a rule that connects 4002 to 4004, and another one for the reverse. I also have to connect the web server ports, so another 2 rules for those ports. It seems very tedious, and I'd have to tear it all down if I ever reset the network for testing. It sounds like switching to WSL1 is the best idea.


SVG not supported

Login to reply

👍?
helpful

I am also having problems communicating between devices on the same network (e.g. UnifiIOT). I was developing the python code in WSL2 but after not being able to connect to the server from my phone, I decided to try just running the server program directly on Windows. All my efforts thus far have been to no avail as I am only able to connect to a server from the same device it is hosted on.

When the server code starts on UnifiIOT, it prints something to the effect of

<socket.socket fd=340, family=2, type=1, proto=0, laddr=('0.0.0.0', 4001)>
<socket.socket fd=316, family=2, type=2, proto=0, laddr=('0.0.0.0', 4002)>
172.17.X.X

which I think suggests that it should be accessible at 172.17.X.X:4001 from any device on the same network. Maybe there is something I am missing, but it would be good if anyone who has managed to get connectivity to let me know how you did it.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy