• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code async_load "ip" truncates ip address

Greetings,

I have been working through understanding networking, and doing so I made a little script that shows me the connection information of the clients. As a network engineer by trade, I like to see this sort of thing. One thing I noticed was when a client had a long an ip address, where the string value was the longest possible length, when asking for the "ip" value from async_load, it didn't return the whole thing.

For example, an ip address of 192.168.200.123 has a string length of 15 --- 3 characters per octet plus 3 dots.

But when I capture the ip address during the Async Networking network_type_connect event, using GML code: show_debug_message(ds_map_find_value(async_load, "ip"))

...the output I see is: 192.168.200.12

It cuts off the last character =/

Bug?
 

Homunculus

Member
Are you sure this isn't supposed to be 192.168.200.012 , therefore a correct ip address just with the leading zero on the last octet omitted?
 
I can view the IP address of the client system, all 4 octets are 3 characters long.

Ethernet adapter Ethernet:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : (snip)
IPv4 Address. . . . . . . . . . . : 192.168.200.123
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.200.1



The game engine is definitely truncates off the last character.

Also, when a client connects to a server, the server puts into its Output window what the connecting IP is, also when it disconnects. That IP address is also truncated.

Client(1) Connected: 192.168.200.12
Client(1) Disconnected: 192.168.200.12


It would be easy to reproduce, have a client and server app, the server needs to run in the GMS2 IDE, change your IP address to have 3 numbers in each octet, and then tell the client to connect to the IP address (not the localhost/127.0.0.1), and then finally look at the Output log. Since the connection works, it is a cosmetic issue. The game engine knows how to send packets back to the client so there is no issue with the client and server connecting, just displaying the correct ip address when the ip address has the longest possible string length.
 
Top