Server equilavent to clientEvent()?

I’m trying to make a multiplayer game, and at the start it needs to send map data across from the host to the other players. A lot of examples I’ve seen use two different applications, a client and a server, but I’ve tied it into one program so the person can play or host and play from the same program. Initially I was using write() and readString() to send/recieve data but often some bits of data would get dropped since it was tied to the framerate. I found clientEvent() which runs the code every time the server receives data from the client. I set it up so it appends whatever data it receives to a string and it waits until its received the full message. This works great and after testing for a while it hasn’t dropped anything.

The problem is I can’t find an equivalent method for running code when the server receives data from the client. I could still readString() each frame but it would be slow and unreliable. Does anyone know how I could achieve this?

code snippet from the clientEvent method:

void clientEvent(Client someClient) {
  testmessage += getDataString();

Also, I’m aware serverEvent exists but it only runs when a client joins the server, not when a client sends a message.
Thanks in advance.