QuickServer Development Guide (9) - Data Mode and Data Types

xiaoxiao2021-03-06  42

Until now our communication is only using a string ending with . Of course, it is most common in the Internet standard protocol. But sometimes we may need to receive a word current or Java object.

Below is a data mode and data type, use it you can tell WhitHandler Which communication mode is used.

Data mode is used to define data exchange format between QuickServer and customer socket. Here are three models that are currently supported:

DataMode.String - This is the default swap mode. In this mode you can receive string data (ends with ) DATAMODE.Object - you can receive sequentially Java objects in this mode. . This mode is only used in the case where the client can write Java. DataMode.byte - In this mode you can receive all bytes sent by the client, including or or any other control character. This model is very useful when processing hardware based on client or non-standard protocols such as XML or protocols you defined. Data Type User Defines Data Exchange Types between QuickServer and Customer Socket. There are currently two formats: DataType.in - Specify data to enter data for QuickServer. DataType.out - Specifies the data output from QuickServer.

Data modes of any data type can be set using ClientHandler's setDataMode () method setting, format setDataMode (DataType ") Note: When the mode is DATAMODE.Object type DataType.in, the call will block until the client's ObjectOutputStream Written and headed.

转载请注明原文地址:https://www.9cbs.com/read-52578.html

New Post(0)