It is using Java to write a code to connect to the MSN server, but find how to send a command message to the MSN server, the result is only one, that is, there is no response, then the socket connection is turned off.
The code for sending messages is as follows:
Public Void Send (String CMD)
{
Try {
DataOutputStream DOS = New DataOutputStream (SOCK_.GETOUTPUTSTREAM ());
Dos.WriteUTF (CMD);
} catch (Exception EX)
{
System.out.println ("MSNPConnection :: Send Fail," EX.GetMessage ());
}
}
The command format that just started to send to the server was wrong, so all sent packets were cut out. I found a strange phenomenon in the interception. I have two bytes before you send each command, and it is obviously a number, so I started to comprehend, is it Writeutf in it?
Open the JDK document, search directly, find the following text:
Writeutf
Public void Writeutf (String STR)
Throws oException
Writes Two bytes of longth information to the output stream, Followed by The Java Modified Utf Reperesentation of Every Character in the string.
God, really is played, the original Writeutf will be self-righteous and the length information is concluded.