![]() |
Powernet-Networking Unable to Send Complex Packets - Printable Version +- Goonstation Forums (https://forum.ss13.co) +-- Forum: Discussion (https://forum.ss13.co/forumdisplay.php?fid=6) +--- Forum: Bug Reports (https://forum.ss13.co/forumdisplay.php?fid=9) +---- Forum: Features (https://forum.ss13.co/forumdisplay.php?fid=23) +---- Thread: Powernet-Networking Unable to Send Complex Packets (/showthread.php?tid=6992) |
Powernet-Networking Unable to Send Complex Packets - ihenn - 08-30-2016 The Powernet-Networking component is only capable of sending simple packets, like the following: command=term_connect&address_1=00000000&sender=11111111 But it is unable to send a complicated packet like the following. By unable to send, I mean it still sends it but information is lost. command=term_message&address_1=00000000&sender=11111111&data=command=cmd&cmdval1=1&cmdval2=2 This results in a packet sent that looks like this: command=term_message;address_1=00000000;sender=11111111;data=command=cmd;cmdval1=1;cmdval2=2; But it should look like this (this is what it looks like when sent through SigPal): command=term_message;address_1=00000000;sender=11111111;data=command=cmd&cmdval1=1&cmdval2=2; Looking at the code, I think the problem is the params2list function. It needs to have a way to convert into a multidimensional list, or not use param2list at all and do it by hand. That is what is done with the sendRaw function for packet output, so why not the same for packet input? RE: Powernet-Networking Unable to Send Complex Packets - ihenn - 09-01-2016 Digging deeper, I found a workaround for this problem here. The key is to replace the special characters ("&" and "=") with codes which will later be converted back into the corresponding character. This allows a two dimensional list to be formed, and the format is quite ugly: = becomes %3d & becomes %26 name1=val1&name2=subname1%3dsubval1%26subname2%3dsubval2&name3=val3 I would much rather it be more intuitive and easier to read, like the following: name1=val1&name2=(subname1=subval1&subname2=subval2)&name3=val3 Using parentheses to group items as a value would also allow multidimensional lists to be formed from a string input. Edit: Link to potential patch |