示例#1
0
 /// <summary>
 /// 发送
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 /// <param name="content"></param>
 /// <param name="encoding"></param>
 /// <returns></returns>
 /// <exception cref="SocketException">访问套接字时出错</exception>
 /// <exception cref="InvalidOperationException">未连接到远程主机</exception>
 /// <exception cref="IOException">IO异常</exception>
 public static string Send(string ip, int port, string content, Encoding encoding)
 {
     return(Tcp.Send(ip, port, encoding.GetBytes(content)).ToString(encoding));
 }
示例#2
0
 /// <summary>
 /// 发送一行
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 /// <param name="content"></param>
 /// <param name="encoding"></param>
 /// <returns></returns>
 /// <exception cref="SocketException">访问套接字时出错</exception>
 /// <exception cref="InvalidOperationException">未连接到远程主机</exception>
 /// <exception cref="IOException">IO异常</exception>
 public static string SendLine(string ip, int port, string content, Encoding encoding)
 {
     return(Tcp.Send(ip, port, content + Symbol.NewLine, encoding));
 }