Network Protocol

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
narrowtux
Inserter
Inserter
Posts: 25
Joined: Sat Jul 04, 2015 11:27 am
Contact:

Network Protocol

Post by narrowtux »

I've been wondering how the network protocol works, because I want to offer a feature in my mod manager that detects mods needed to play on a multiplayer server so it is able to install those mods before launching factorio.

Anyway, I've used a network sniffer to get some of the handshake between client and (in this case dedicated) server. The client sends one packet containing this:

Code: Select all

08 96 D7 63 90 D7 B8 E8 56 13 9E 34 08 00 45 00 01 08 7C DB 00 00 40
11 D2 75 C0 A8 B2 A5 BC A5 FA A0 85 95 85 95 00 F4 BA D0 10 01 D4 47 
00 00 0C 00 05 00 D2 40 15 00 00 00 31 38 38 2E 31 36 35 2E 32 35 30 
2E 31 36 30 3A 33 34 31 39 37 0A 00 00 00 04 00 00 00 62 61 73 65 00 
00 0C 00 05 00 08 00 00 00 4C 61 6E 64 66 69 6C 6C 02 00 01 00 05 00 
0B 00 00 00 62 6F 62 61 73 73 65 6D 62 6C 79 00 00 0C 00 02 00 0A 00 
00 00 62 6F 62 65 6E 65 6D 69 65 73 00 00 0C 00 03 00 0C 00 00 00 62 
6F 62 6C 6F 67 69 73 74 69 63 73 00 00 0C 00 03 00 09 00 00 00 62 6F 
62 6D 69 6E 69 6E 67 00 00 0C 00 01 00 0A 00 00 00 62 6F 62 6D 6F 64 
75 6C 65 73 00 00 0C 00 03 00 08 00 00 00 62 6F 62 70 6F 77 65 72 00 
00 0C 00 02 00 05 00 00 00 63 6C 6F 63 6B 00 00 0C 00 00 00 10 00 00 
00 6E 6F 2D 68 61 6E 64 2D 63 72 61 66 74 69 6E 67 00 00 0C 00 01 00 
CE 1F
(ascii representation)

Code: Select all

ñ◊cê◊∏ËVû4E|€@“u¿®≤•º•˙†ÖïÖïÙ∫–‘G“@188.165.250.160:34197
baseLandfillbobassembly
bobenemiesboblogistics	bobmining
bobmodulesbobpowerclockno-hand-craftingŒ
And the server replies with

Code: Select all

B8 E8 56 13 9E 34 08 96 D7 63 90 D7 08 00 45 00 01 43 00 00 40 00 37 
11 18 16 BC A5 FA A0 C0 A8 B2 A5 85 95 85 95 01 2F 1B BB 11 01 D4 47 
01 28 00 00 00 41 63 74 69 76 65 20 6D 6F 64 73 20 63 6F 6E 66 69 67
75 72 61 74 69 6F 6E 20 64 6F 65 73 6E 27 74 20 6D 61 74 63 68 2E 06 
00 00 0C 00 05 00 D2 40 0C 00 00 00 04 00 00 00 62 61 73 65 00 00 0C 
00 05 00 0B 00 00 00 62 6F 62 61 73 73 65 6D 62 6C 79 00 00 0C 00 02 
00 0A 00 00 00 62 6F 62 65 6E 65 6D 69 65 73 00 00 0C 00 03 00 07 00 
00 00 62 6F 62 6F 72 65 73 00 00 0C 00 02 00 07 00 00 00 62 6F 62 74 
65 63 68 00 00 0C 00 02 00 09 00 00 00 62 6F 62 70 6C 61 74 65 73 00 
00 0C 00 03 00 0E 00 00 00 62 6F 62 65 6C 65 63 74 72 6F 6E 69 63 73 
00 00 0C 00 02 00 0C 00 00 00 62 6F 62 6C 6F 67 69 73 74 69 63 73 00 
00 0C 00 03 00 09 00 00 00 62 6F 62 6D 69 6E 69 6E 67 00 00 0C 00 01 
00 08 00 00 00 62 6F 62 70 6F 77 65 72 00 00 0C 00 02 00 0A 00 00 00 
62 6F 62 77 61 72 66 61 72 65 00 00 0C 00 03 00 0A 00 00 00 62 6F 62 
6D 6F 64 75 6C 65 73 00 00 0C 00 03 00 CE 1F
(ascii representation)

Code: Select all

∏ËVû4ñ◊cê◊EC@7º•˙†¿®≤•ÖïÖï/ª‘G(Active mods configuration doesn't match.“@basebobassembly
bobenemiesboboresbobtech	bobplatesbobelectronicsboblogistics	bobminingbobpower
bobwarfare
bobmodulesŒ
As you can see from the ascii representations, the client sends its whole mod list to the server using the known format from the save game.

The server then marks some flag as true to say there's an error message and writes the message "Active mods configuration doesn't match.".

Then after some other bytes I don't yet know the purpose of, it sends their mod list and then probably closes the connection.

I'll try to research more about the protocol in just those 2 packets, but maybe someone already did that and can enlighten me or give some hints.
Attachments
factorio server.log
Sniffer log with 2 packets (open with wireshark or something)
(671 Bytes) Downloaded 234 times

narrowtux
Inserter
Inserter
Posts: 25
Joined: Sat Jul 04, 2015 11:27 am
Contact:

Re: Network Protocol

Post by narrowtux »

I made a google drive spreadsheet outlining stuff I understand about the protocol. If anyone sees something they know what it means, feel free to add a comment about it

https://docs.google.com/spreadsheets/d/ ... edit#gid=0

Post Reply

Return to “Modding discussion”