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) {
  println(testmessage);
  testmessage += getDataString();
  if(testmessage.contains("\n")){
    if(testmessage!=null&&testmessage.length()>=2){
      if(testmessage.charAt(0)=='!'){
        consoleUpdate(testmessage.substring(1,testmessage.length()));
      }
    }
    testmessage="";
  }
}

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.