Yes it timed out there. I am trying it with Traccar Client on phone and the vps is receiving packets thought the tcpdump command but the script isnt reacting to it
I just tried echo "CONNECT" | nc localhost 30175
where 30175 is the port the script is listening to and mine responded:
receiving data 376 bytes
receiving data 408 bytes
Data transmitted
Data transmitted
connect
[*]Accepted connection from 172.18.0.1:58752
receiving data 8 bytes
Data transmitted
But I think you found that it's not starting the server. Is there anything in syslog? maybe permissions creating a socket or apparmor or somethign like that getting in the way?
From localhost its working
In your traccar, can you see the connection?
2025-02-07 08:36:26 INFO: [T6e9451c3] connected
2025-02-07 08:36:26 INFO: [T6e9451c3: osmand < 192.168.10.100] CONNECT\n
2025-02-07 08:36:26 INFO: [T6e9451c3: osmand > 192.168.10.100] HTTP/1.1 400 Bad Request\r\ncontent-length: 0\r\n\r\n
2025-02-07 08:36:26 INFO: [T6e9451c3] disconnected
That was me doing an echo "CONNECT" to the script and it's been forwared to traccar. I can't remember the actual command I need to set a device online with the OSMND protocol.
In the traccar i see connected disconnected thats because the nc is just empty but the problem is somewhere on the vps cause when i tried the nc command from other device like "nc 'publicIPofVPS' 5055" nothing happened
So i looked at my ingress rules, I don't allow source of 0.0.0.0, but I restrict it to a pretty high level for the mobile network my device will connect to.
Did you fire "CONNECT" or some actual tcp data and pick that up in traccar? I think the script by default connects and disconnects all the time. You want to see, like mine a bad request listed by traccar, to verify the script actually picked up the tcp command you fired.
maybe try instead of listening on 0.0.0.0 to listen on the actual external ip of the VM?
https://www.reddit.com/r/learnpython/comments/75fwyt/trying_to_write_a_simple_socket_server_stuck_at/
I didnt actually. Oracles machine died now. Thanks for your help maybe ill try it again sometime or just pay my provider for public ip
Umm it might actually be it. cause on my intefaces there was only private ip and it was natting it but when u listen on 0.0.0.0 it might just listen on the private IP ? idk
One more question do you have internet gateway setup in the oracle cloud with ur subnet that vps is in?
not sure. Dont think so, the set up is pretty limited. Just the ingress rules. I onlty have the networks pages and VM page pinned - meaning I don't tend to look around too far.
I think you can add
before the while True and it should time out in connecting at least - but wont help you if it's not connecting.
But sorry, i really don't know why it's not getting past that line for you.
Mine is in a docker container, and looks like it's python 3.9
I can see this being set as an argument in the Dockerfile : ARG PYTHONUNBUFFERED=0