예제 #1
0
        /// <param name="protocol">통신할 때 사용되는 규칙 (null : 기본값 int)</param>
        /// <param name="noDelay">패킷을 여러 개 모아 전송할 지 여부</param>
        /// <param name="useKeepAlive">연결 유지 사용</param>
        /// <param name="keepAliveTime">연결 유지 시간제한 (밀리초)</param>
        /// <param name="keepAliveInternal">연결 유지 간격 (밀리초)</param>
        /// <param name="useLinger">연결 끊김 시 남은 버퍼 전송 여부</param>
        /// <param name="lingerTime">남은 버퍼 전송 대기시간 (초)</param>
        public ClientBase(NetProtocol protocol = null, bool noDelay = false, bool useKeepAlive = true, int keepAliveTime = 3000, int keepAliveInternal = 1000, bool useLinger = false, int lingerTime = 3)
        {
            if (protocol == null)
            {
                protocol = new NetProtocol();
            }

            this.protocol          = protocol;
            this.noDelay           = noDelay;
            this.useKeepAlive      = useKeepAlive;
            this.useLinger         = useLinger;
            this.keepAliveTime     = keepAliveTime;
            this.keepAliveInterval = keepAliveInternal;
            this.lingerTime        = lingerTime;

            header = new byte[protocol.HeaderSize];
        }
예제 #2
0
        /// <param name="protocol">통신할 때 사용되는 규칙 (null : 기본값)</param>
        /// <param name="noDelay">패킷을 여러 개 모아 전송할 지 여부</param>
        /// <param name="useKeepAlive">연결 유지 사용</param>
        /// <param name="keepAliveTime">연결 유지 시간제한 (밀리초)</param>
        /// <param name="keepAliveInternal">연결 유지 간격 (밀리초)</param>
        /// <param name="useLinger">연결 끊김 시 남은 버퍼 전송 여부</param>
        /// <param name="lingerTime">남은 버퍼 전송 대기시간 (초)</param>
        public ServerBase(NetProtocol protocol = null, bool noDelay = false, bool useKeepAlive = true, int keepAliveTime = 3000, int keepAliveInternal = 1000, bool useLinger = false, int lingerTime = 3)
        {
            if (protocol == null)
            {
                protocol = new NetProtocol();
            }

            this.protocol          = protocol;
            this.noDelay           = noDelay;
            this.usekeepAlive      = useKeepAlive;
            this.useLinger         = useLinger;
            this.keepAliveTime     = keepAliveTime;
            this.keepAliveInternal = keepAliveInternal;
            this.lingerTime        = lingerTime;

            Init();
        }
예제 #3
0
 public byte[] ToArray(NetProtocol protocol)
 {
     byte[] header = protocol.Header2Bytes(Count);
     return(header.Concat(byteQueue.ToArray()).ToArray());
 }