Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write specific commands on the Java Socket server

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report