I am not going to bother reading that source, but I can tell you the parameters needed to connect and maintain a connection.

usually upon initial connect, the client sends:

NICK nickname
USER username "localhost" "remotehost" :real name

Note the colon before the real name. This is required.
The server will then send a PING command such as this:

PING :98273649

Whenever you receive a PING command, you should reply PONG with the same parameter. This goes for the initial connection as well as any subsequent PINGs.

Client sends PONG :98273649

After you are connected, a PING parameter may just be the server name instead of a random number. The reply is no different. your PONG should be exactly like the PING.