本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}