SSWriter
from panda3d.core import SSWriter
- class SSWriter
Bases:
An internal class for writing to a socket stream. This serves as a base class for both
OSocketStream
andSocketStream
; its purpose is to minimize redundant code between them. Do not use it directly.Inheritance diagram
- close()
- considerFlush() bool
Sends the most recently queued data if enough time has elapsed. This only has meaning if
setCollectTcp()
has been set to true.
- flush() bool
Sends the most recently queued data now. This only has meaning if
setCollectTcp()
has been set to true.
- getCollectTcp() bool
Returns the current setting of “collect-tcp” mode. See
setCollectTcp()
.
- getCollectTcpInterval() float
Returns the interval in time, in seconds, for which to hold TCP packets before sending all of the recently received packets at once. This only has meaning if “collect-tcp” mode is enabled; see
setCollectTcp()
.
- getTcpHeaderSize() int
Returns the header size for datagrams. See
setTcpHeaderSize()
.
- sendDatagram(dg: Datagram) bool
Transmits the indicated datagram over the socket by prepending it with a little-endian 16-bit byte count. Does not return until the data is sent or the connection is closed, even if the socket stream is non-blocking.
- setCollectTcp(collect_tcp: bool)
Enables or disables “collect-tcp” mode. In this mode, individual TCP packets are not sent immediately, but rather they are collected together and accumulated to be sent periodically as one larger TCP packet. This cuts down on overhead from the TCP/IP protocol, especially if many small packets need to be sent on the same connection, but it introduces additional latency (since packets must be held before they can be sent).
See
setCollectTcpInterval()
to specify the interval of time for which to hold packets before sending them.If you enable this mode, you may also need to periodically call
considerFlush()
to flush the queue if no packets have been sent recently.
- setCollectTcpInterval(interval: float)
Specifies the interval in time, in seconds, for which to hold TCP packets before sending all of the recently received packets at once. This only has meaning if “collect-tcp” mode is enabled; see
setCollectTcp()
.