当前位置: 首页>>代码示例>>C#>>正文


C# Connection.Write方法代码示例

本文整理汇总了C#中Connection.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.Write方法的具体用法?C# Connection.Write怎么用?C# Connection.Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection.Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: exchangeData

    public static void exchangeData(Connection connection)
    {
        while(true) {
            //client getur ekki lesið á með þetta er ekki að fá neitt
            //string received = connection.Read();

            //string coords = ball.x + "," + ball.y + "," + PlayerScore1  + "," +  PlayerScore2  + "," + paddle1;
            string coords = ball.x+","+ball.y;

            connection.Write(coords);
         	}
    }
开发者ID:Splendid93,项目名称:LokaverkefniFOR3A3U,代码行数:12,代码来源:server.cs

示例2: SendCommand

        //-------------------------------------------------------
        // Private methods.
        //-------------------------------------------------------
        /// <summary>
        /// Issue request and set results buffer. This method is used internally.
        /// The static request methods should be used instead.
        /// </summary>
        /// <param name="conn">socket connection to server node</param>
        /// <exception cref="AerospikeException">if socket send or receive fails</exception>
        private void SendCommand(Connection conn)
        {
            try
            {
                // Write size field.
                ulong size = ((ulong)offset - 8L) | (2L << 56) | (1L << 48);
                ByteUtil.LongToBytes(size, buffer, 0);

                // Write.
                conn.Write(buffer, offset);

                // Read - reuse input buffer.
                conn.ReadFully(buffer, 8);

                size = (ulong)ByteUtil.BytesToLong(buffer, 0);
                length = (int)(size & 0xFFFFFFFFFFFFL);
                ResizeBuffer(length);
                conn.ReadFully(buffer, length);
                offset = 0;
            }
            catch (SocketException se)
            {
                throw new AerospikeException(se);
            }
        }
开发者ID:Caldas,项目名称:aerospike-client-csharp,代码行数:34,代码来源:Info.cs

示例3: Connect

 public void Connect()
 {
     _conn = new Connection(this, HandleMessage);
     _conn.Write("NICK {0}", NickName);
     _conn.Write("USER {0} {1} {2} :{3}", NickName, "*", 8, RealName);
 }
开发者ID:strider-,项目名称:IrcBot,代码行数:6,代码来源:BotClient.cs


注:本文中的Connection.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。