src/main/java/robocup/server/connection/UDPConnection.java
/**
     * Receives a message from the server, propagating a new connection target, and returns the changed connection to
     * the new target.
     * <p>
     * This is due to the soccer server protocol: first we choose a local port we can receive messages at. Then we send
     * a message from our local port to port 6000 and register as a monitor. We receive an answer on our local port that
     * comes from a third targetPort. This new targetPort is the one we use to communicate with the server from now on
     * (so we overwrite the targetPort 6000). Note that we have to keep our local port the entire time so that the
     * server can identify us. Because of this we have to overwrite the targetPort field in this class during the
     * connection procedure instead of creating a new instance (that would have a different local port).
     *
     * @return the functional monitor connection
     * @throws IOException
     */
Receives a message from the server, propagating a new connection target, and returns the changed connection to
the new target.

This is due to the soccer server protocol: first we choose a local port we can receive messages at. Then we send
a message from our local port to port 6000 and register as a monitor. We receive an answer on our local port that
comes from a third targetPort. This new targetPort is the one we use to communicate with the server from now on
(so we overwrite the targetPort 6000). Note that we have to keep our local port the entire time so that the
server can identify us. Because of this we have to overwrite the targetPort field in this class during the
connection procedure instead of creating a new instance (that would have a different local port).

@return the functional monitor connection
@throws IOException
Receives a message from the server propagating a new connection target and returns the changed connection to the new target . This is due to the soccer server protocol : first we choose a local port we can receive messages at . Then we send a message from our local port to port 6000 and register as a monitor . We receive an answer on our local port that comes from a third targetPort . This new targetPort is the one we use to communicate with the server from now on ( so we overwrite the targetPort 6000 ) . Note that we have to keep our local port the entire time so that the server can identify us . Because of this we have to overwrite the targetPort field in this class during the connection procedure instead of creating a new instance ( that would have a different local port ) . @return the functional monitor connection @throws IOException
public UDPConnection receiveNewConnection() throws IOException {
        DatagramPacket packet = receivePacket();
        this.targetHostAddress = packet.getAddress();
        this.targetPort = packet.getPort();
        log.info("Changed Socket on local port " + socket.getLocalPort() + " " +
                "to " +
                this.targetHostAddress + ":" + this.targetPort);
        return this;
    }
public UDPConnection receiveNewConnection ( ) throws IOException { DatagramPacket packet = receivePacket ( ) ; this . targetHostAddress = packet . getAddress ( ) ; this . targetPort = packet . getPort ( ) ; log . info ( "Changed Socket on local port " + socket . getLocalPort ( ) + " " + "to " + this . targetHostAddress + ":" + this . targetPort ) ; return this ; }
Receives a message from the server, propagating a new connection target, and returns the changed connection to
 the new target.
Receives a message from the server propagating a new connection target and returns the changed connection to the new target .