cup.net.async package¶
Submodules¶
cup.net.async.common module¶
common function module for cup.net.async
cup.net.async.conn module¶
descrition: | connection related module
Notice that _do_write will only TRY to send out some data. It might encounter TCP/IP stack full of data in the SEND buffer-queue of the network interface |
---|
cup.net.async.context module¶
description: | Connection Context for each socket |
---|
-
class
cup.net.async.context.
CConnContext
[source]¶ Bases:
object
connection context for each socket
-
CONTEXT_QUEUE_SIZE
= 200¶
-
do_recv_data
(data, data_len)[source]¶ push data into the recving_msg queue network read should be in 1 thread only.
-
put_msg
(flag, msg)[source]¶ Put msg into the sending queue.
Parameters: - flag –
flag determines the priority of the msg.
Msg with higher priority will have bigger chance to be
sent out soon.
- return – return 0 on success return 1 on TRY_AGAIN —- queue is full. network is too busy.
TODO: If the msg queue is too big, consider close the network link
- flag –
-
cup.net.async.msg module¶
description: | netmsg related module |
---|
-
class
cup.net.async.msg.
CNetMsg
(is_postmsg=True)[source]¶ Bases:
object
flag: System use only. type: System will use type > 65535. Users will use type <=65535
#head CUP012-3 for building connection #len - uint64 #fromip,port, stub -uint64 #toip,port, stub -uint64 #msg_type -uint32 #uniqid -128bit [64bit ip, port, 64 bit, uniqid] #body -no limit (length:uint64)
-
MSGTYPE
= <cup.net.async.msg.CMsgType object>¶
-
MSG_FLAG_MAN
= <cup.net.async.msg.CMsgFlag object>¶
-
MSG_SIGN
= 'CUP012-3'¶
-
push_data
(data)[source]¶ push data into the msg. Return pushed length.
Return -1 if we should shutdown the socket channel.
Raises: exception – may raise IndexError when coming msg has problems.
-
-
class
cup.net.async.msg.
CAckMsg
(is_postmsg=True)[source]¶ Bases:
cup.net.async.msg.CNetMsg
ack msg example
cup.net.async.msgcenter module¶
descrition: | msg center related module |
---|
Module contents¶
description: | Async Module is a tcp framework for asynchrous network msg tranfering |
---|