The first thing we are going to do is to send a packet containing "Hello client!" from the server to all connected clients. We start by adding a packet identifier. Open up net_packet_init and below the "//Add your packet identifers here" line, add the following code:

net_packet_identifier_create("Hello World", undefined, net_hello);

This code will create a packet identifier with the name "Hello World", we say that the server should not execute any script if they were to receive a packet with this identifier, and that the client should execute the net_hello script, which we are going to add next.

Create a new script in the "Scripts/Net/Scripts" folder and name it "net_hello". Put this code in it:

show_message(ds_list_find_value(argument0, 1));

Now we have handled what will happen when the client receives a Hello World packet. It will show a message containing the second value, which is the first position where data is in the list that comes as argument0. Now to send the packet from the server to the client, add a Key Pressed event to obj_server and add this code:

net_packet_create("Hello World");
net_packet_add(Hello client!");
net_packet_send(Net.AllClients);