ShadowKatStudios / OC-Minitel

Easy-to-implement networking protocol for OpenComputers
https://oc.shadowkat.net/minitel/
Mozilla Public License 2.0
41 stars 12 forks source link

Calculate MTU based on max packet size #26

Open XeonSquared opened 5 years ago

XeonSquared commented 5 years ago

maxPacketSize(): number Returns the maximum packet size for sending messages via network cards. Defaults to 8192. You can change this in the OpenComputers configuration file.

Every value in a message adds two bytes of overhead. (Even if there's only one value.) Numbers add another 8 bytes, true/false/nil another 4 bytes, and strings exactly as many bytes as the string contains—though empty strings still count as one byte.

The Minitel MTU should be calculable from the OC max packet size.