View Issue Details

IDProjectCategoryView StatusLast Update
0006033Spring engineLuapublic2018-08-26 19:54
ReporterStickyStains Assigned Toabma  
PrioritylowSeverityminorReproducibilityhave not tried
Status resolvedResolutionno change required 
Product Version104.0 
Summary0006033: Failure to bind UDP-IP Addresses
DescriptionHi, im for quiet some time trying to tie a cellphone as a AR-Device to spring.

The problem i ran into is, that i can quite well send message as broadcast from spring and recieve broadcasts from the external device.
But once i try to limit this to a specific ip - i do no longer receive communication-data.

Maybe im doing it wrong, but could you point me to a working udp example or explain this behavior?

The lastest version of my widget:
https://github.com/PicassoCT/Journeywar/blob/develop/LuaUI/widgets/gui_arCam.lua
(Be warned though, i tried to fall back on broadcasting everything in this version)



TagsNo tags attached.
Attached Files
ar_package_drop-2.pcapng (Attachment missing)
Software_Design.svg.xml (Attachment missing)
Checked infolog.txt for Errors

Activities

abma

2018-08-14 15:23

administrator   ~0019291

infolog.txt?

> But once i try to limit this to a specific ip - i do no longer receive communication-data.

can you point to the specific code?

StickyStains

2018-08-14 21:34

reporter   ~0019292

icassoCT/Journeywar/blob/9e0810e3a62d647c63ae5e0de03951ef487a8a54/LuaUI/widgets/gui_arCam.lua

This contains the whole AR-Device widget. All Communication is controlled by a simple Statemachine, that is defined in a Table at the end of the file called : communicationStateMachine.

At the beginning it waits for a broadcast by the device. This broadcast is recieved (I currently send the packages manually with package sender from my phone).

After the broadcast is recived, it opens another UDP-port, and waits for the Configuration message from the device.

If the message is send manually to a specific ip, it is never received.
If it send via broadcast, it is recived, by the second, more limited UDP-Port.

To clarify, i dont think there is a bug here, i just might have configured the whole thing wrong.

http://paste.springfiles.com/view/5da0566a

I tryied to use this as a example.

StickyStains

2018-08-14 21:35

reporter   ~0019293

https://github.com/PicassoCT/Journeywar/blob/9e0810e3a62d647c63ae5e0de03951ef487a8a54/LuaUI/widgets/gui_arCam.lua

abma

2018-08-14 23:01

administrator   ~0019294

> lua: server.lua:1: module 'common' not found:

where is common.lua?

abma

2018-08-14 23:04

administrator   ~0019295

+ infolog.txt

StickyStains

2018-08-14 23:53

reporter   ~0019296

server.lua is part of a loeve project i downloaded, which had the same udp-socket implementation in the c++ part of the engine.
exampleLuaServer.7z (Attachment missing)

abma

2018-08-15 00:57

administrator   ~0019297

Last edited: 2018-08-15 00:57

i've set in common.lua:

G_PORT = 9000
B_PORT = 8090

and in server.lua moved
        assert(broadcast:setoption('broadcast', true))
below
        assert(broadcast:setsockname("*", B_PORT))


then i get:
[f=0016636] Recieved text ERROR:10,Invalid command. from 192.168.1.254



tcpdump says it communicates probably:

00:53:58.583721 IP 192.168.1.205.9000 > 255.255.255.255.9000: UDP, length 24
00:53:58.584105 IP 192.168.1.254.9000 > 192.168.1.205.9000: UDP, length 25

abma

2018-08-15 00:57

administrator   ~0019298

side note:

the code is VERY unreadable. you should fix that :-|

abma

2018-08-15 01:02

administrator   ~0019299

i don't understand what doesn't work.

did you set
UDPAllowConnect = *:-1

in springsettings?

without posting your infolog.txt with the errors/problems inside i refuse to help any more.

StickyStains

2018-08-15 09:00

reporter   ~0019300

I have
UDPAllowConnect=*
and
UDPAllowListen=*
infolog.txt (Attachment missing)

StickyStains

2018-08-15 09:26

reporter   ~0019301

I modified the settings to UDPAllowConnect = *:-1 and the same for Listening.

Still shows the same behavior.

I added a wireshark capture of all packages involved. The broadcast always wents through, while the device only ones are passed over.

Regarding code quality:
https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/

StickyStains

2018-08-15 09:27

reporter   ~0019302

Sorry, first package drop was unfiltered

abma

2018-08-15 10:34

administrator   ~0019303

infolog.txt is incomplete... can you post one containing a failing try?

StickyStains

2018-08-15 11:29

reporter   ~0019304

Added a new infolog, this time with no broadcast messages beyond the initial broadcast.

As expected the state_machine is stuck in waiting for cfg.
infolog-2.txt (Attachment missing)

StickyStains

2018-08-15 11:35

reporter   ~0019305

Adding a State Diagram to better explain the communication
State_Diagram.pdf (Attachment missing)

StickyStains

2018-08-15 11:42

reporter   ~0019306

All is full of watermarks :(

abma

2018-08-15 12:16

administrator   ~0019307

Last edited: 2018-08-15 12:17

tcpdump -r ar_package_drop-2.pcapng -vv

reading from file ar_package_drop-2.pcapng, link-type EN10MB (Ethernet)
09:20:28.584634 IP (tos 0x0, ttl 128, id 28354, offset 0, flags [none], proto UDP (17), length 112, bad cksum 0 (->f1ab)!)
    192.168.178.20.63763 > 162.254.196.83.27017: [bad udp cksum 0xda7c -> 0x098d!] UDP, length 84
09:20:37.598839 IP (tos 0x0, ttl 128, id 28355, offset 0, flags [none], proto UDP (17), length 112, bad cksum 0 (->f1aa)!)
    192.168.178.20.63763 > 162.254.196.83.27017: [bad udp cksum 0xda7c -> 0xb124!] UDP, length 84
09:20:46.611904 IP (tos 0x0, ttl 128, id 28356, offset 0, flags [none], proto UDP (17), length 112, bad cksum 0 (->f1a9)!)
    192.168.178.20.63763 > 162.254.196.83.27017: [bad udp cksum 0xda7c -> 0xb63f!] UDP, length 84
09:20:47.033423 IP (tos 0x0, ttl 122, id 17966, offset 0, flags [DF], proto UDP (17), length 64)
    162.254.196.83.27017 > 192.168.178.20.63763: [udp sum ok] UDP, length 36

why are total different ports used and the ip's are different too? also i don't see a broadcast?!

bad udp cksum could be because of udp checksum offload.

did you try with firewall disabled?

if i understood you correctly the last packet is not received:

162.254.196.83.27017 > 192.168.178.20.63763

StickyStains

2018-08-15 12:24

reporter   ~0019308

Another thing i noticed- the package is received, as long as i send it to the correct IP- with the broadcast port.

abma

2018-08-26 19:54

administrator   ~0019323

i don't see a bug in spring...

follow up: https://springrts.com/phpbb/viewtopic.php?f=21&p=587178

Issue History

Date Modified Username Field Change
2018-08-14 14:07 StickyStains New Issue
2018-08-14 15:23 abma Note Added: 0019291
2018-08-14 21:34 StickyStains Note Added: 0019292
2018-08-14 21:35 StickyStains Note Added: 0019293
2018-08-14 23:01 abma Note Added: 0019294
2018-08-14 23:04 abma Note Added: 0019295
2018-08-14 23:53 StickyStains File Added: exampleLuaServer.7z
2018-08-14 23:53 StickyStains Note Added: 0019296
2018-08-15 00:57 abma Note Added: 0019297
2018-08-15 00:57 abma Note Added: 0019298
2018-08-15 00:57 abma Note Edited: 0019297
2018-08-15 01:02 abma Assigned To => abma
2018-08-15 01:02 abma Status new => feedback
2018-08-15 01:02 abma Note Added: 0019299
2018-08-15 09:00 StickyStains File Added: infolog.txt
2018-08-15 09:00 StickyStains Note Added: 0019300
2018-08-15 09:00 StickyStains Status feedback => assigned
2018-08-15 09:26 StickyStains File Added: ar_package_drop.pcapng
2018-08-15 09:26 StickyStains Note Added: 0019301
2018-08-15 09:27 StickyStains File Added: ar_package_drop-2.pcapng
2018-08-15 09:27 StickyStains Note Added: 0019302
2018-08-15 10:34 abma Note Added: 0019303
2018-08-15 11:25 abma File Deleted: ar_package_drop.pcapng
2018-08-15 11:29 StickyStains File Added: infolog-2.txt
2018-08-15 11:29 StickyStains Note Added: 0019304
2018-08-15 11:35 StickyStains File Added: State_Diagram.pdf
2018-08-15 11:35 StickyStains Note Added: 0019305
2018-08-15 11:41 StickyStains File Added: Software_Design.svg.xml
2018-08-15 11:42 StickyStains Note Added: 0019306
2018-08-15 12:16 abma Note Added: 0019307
2018-08-15 12:17 abma Note Edited: 0019307
2018-08-15 12:24 StickyStains Note Added: 0019308
2018-08-26 19:54 abma Status assigned => resolved
2018-08-26 19:54 abma Resolution open => no change required
2018-08-26 19:54 abma Note Added: 0019323