ChannelAddress - jimdroberts/FishMMO GitHub Wiki
Serializable struct representing a network channel address in FishMMO, including IP address, port, and scene handle. Used for network communication and scene management to identify and connect to specific scenes or channels.
-
public string Address
IP address or hostname of the channel.
-
public ushort Port
Port number for the channel.
-
public int SceneHandle
Handle or identifier for the associated scene.
- Create a
ChannelAddress
struct and populate its fields with the desired address, port, and scene handle. - Use the struct when sending or receiving network messages that require channel or scene identification.
// Example 1: Creating a channel address for a scene
ChannelAddress address = new ChannelAddress {
Address = "127.0.0.1",
Port = 7777,
SceneHandle = 1
};
// Use address in network connection logic
- Always provide valid IP addresses and port numbers to avoid connection issues.
- Use unique scene handles to distinguish between different scenes or channels.
- Serialize and deserialize the struct properly when sending over the network.