How to write specific commands on the Java Socket server
Java Socket server specific command writing, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The Java Socket server is constantly developing, and we need to maintain the client constantly when we use it. Let's take a look at how the XMLSocket of the ActionScript on the client can establish a Socket connection to communicate with the Java Socket server of. Net.
ActionScript 3.0 provides a Socket-based network connection class XMLSocket, which we can use directly to develop Socket-based network communications. Establish a basic network connection to the XMLSocket provided by ActionScript 3.0 as follows:
Private function connectionServer (): void {xmlConn = new XMLSocket (); xmlConn.connect ("127.0.0.1", 8888);}
You can then send a message to the Socket server through the XMLSocket instance method send (). The code definition is as follows:
Private function onSend (): void {xmlConn.send (txtData.text + "\ n");}
Complete client code:
! [CDATA [
Import mx.controls.Alert
Private var xmlConn:XMLSocket
Private function connectionServer (): void
{
XmlConn = new XMLSocket ()
XmlConn.connect ("127.0.0.1" 8888)
}
Private function onSend (): void
{
XmlConn.send (txtData.text + "\ n")
}
]]
After reading the above, have you mastered how to write specific commands on the Java Socket server? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!