"Firefly API Documentation"--package Netconnect

Source: Internet
Author: User
Tags unpack

http://bbs.gameres.com/forum.php?mod=viewthread&tid=219655

Package Netconnect

The package contains the service-side communication with the client some of the processing methods, including the encapsulation of the sending data, the encapsulation of the protocol header, TCP communication when the subcontracting, processing sticky packet problem.

Class Connection
A connection object with the client, through which he can communicate with the client, actively disconnect, actively push messages, and so on.

Loseconnection
Disconnecting from the client
Type method
CWD firefly/netconnect/connection.py
Params loseconnection (self)

Safetowritedata
Send a message to the client
Type method
CWD firefly/netconnect/connection.py
Params Safetowritedata (self,topicid,msg)

Class Datapackprotoc
Packet protocol.

Getheadlenght
Gets the length of the packet
Type method
CWD firefly/netconnect/datapack.py
Params Getheadlenght (self)

Unpack
Unpack
Type method
CWD firefly/netconnect/datapack.py
Params Unpack (self,dpack)

Pack
Package Packets
Type method
CWD firefly/netconnect/datapack.py
Params Pack (Self,response,command)

Class ConnectionManager
Connection Manager

Getnowconncnt
Get current number of connections
Type method
CWD firefly/netconnect/manager.py
Params getnowconncnt (self)

Addconnection
Join a connection
Type method
CWD firefly/netconnect/manager.py
Params addconnection (self, conn)

Dropconnectionbyid
To remove a connection instance from a more connected ID
Type method
CWD firefly/netconnect/manager.py
Params Dropconnectionbyid (self, Connid)

Getconnectionbyid
Get a connection by ID
Type method
CWD firefly/netconnect/manager.py
Params Getconnectionbyid (self, Connid)

Loseconnection
Active port connection to client based on connection ID
Type method
CWD firefly/netconnect/manager.py
Params loseconnection (Self,connid)

Pushobject
Proactively push messages
Type method
CWD firefly/netconnect/manager.py
Params Pushobject (Self,topicid, MSG, sendlist)

Class Liberateprotocol
Communication protocol class with Client

Connectionmade
Processing with Client connection establishment
Type method
CWD firefly/netconnect/protoc.py
Params Connectionmade (self)

Connectionlost
Handling when the client connection is disconnected
Type method
CWD firefly/netconnect/protoc.py
Connectionlost (Self,reason)

Safetowritedata
Sending data to the client
@param data:str The data to be written to the client
Type method
CWD firefly/netconnect/protoc.py
Safetowritedata (Self,data,command)

Datahandlecoroutine
Accept the process of client data processing.
Type method
CWD firefly/netconnect/protoc.py
Params Datahandlecoroutine (self)

DataReceived
Data arrival Processing
@param data:str The data sent by the client.
Type method
CWD firefly/netconnect/protoc.py
Params datareceived (self, data)

Class Liberatefactory
Protocol Factory

Setdataprotocl
Sets the packet protocol, specifying the packet protocol.
Type method
CWD firefly/netconnect/protoc.py
Params Setdataprotocl (SELF,DATAPROTOCL)

Doconnectionmade
Processing when a connection is established
Type method
CWD firefly/netconnect/protoc.py
Params Doconnectionmade (Self,conn)

Doconnectionlost
Processing when a connection is broken
Type method
CWD firefly/netconnect/protoc.py
Params Doconnectionlost (Self,conn)

Addservicechannel
Add a service channel
Type method
CWD firefly/netconnect/protoc.py
Params Addservicechannel (Self,service)

Dodatareceived
Processing when data arrives
Type method
CWD firefly/netconnect/protoc.py
Params dodatareceived (Self,conn,commandid,data)

Produceresult
Produce the end result required by the client
@param response:str results obtained by the distributed client
Type method
CWD firefly/netconnect/protoc.py
Params Produceresult (Self,command,response)

Loseconnection
Connection of the active port to the client
Type method
CWD firefly/netconnect/protoc.py
Params active port connection to the client

Pushobject
Server-side push messages to clients
@param the subject ID number of the Topicid:int message
@param msg: The class capacity of the message, PROTOBUF structure type
@param sendlist: Target list to be pushed (client ID list)
Type method
CWD firefly/netconnect/protoc.py
Params Pushobject (Self,topicid, MSG, sendlist)

"Firefly API Documentation"--package Netconnect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.