You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
627 B
25 lines
627 B
using System.Net.Sockets; |
|
using System.Text; |
|
|
|
namespace iMonitorApp |
|
{ |
|
// Token: 0x02000009 RID: 9 |
|
public class SocketClient |
|
{ |
|
// Token: 0x06000043 RID: 67 RVA: 0x0000324C File Offset: 0x0000144C |
|
public static void Send(string ip, int port, string text) |
|
{ |
|
bool flag = !text.Contains("<EOF>"); |
|
if (flag) |
|
{ |
|
text += "<EOF>"; |
|
} |
|
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
|
socket.Connect(ip, port); |
|
byte[] bytes = Encoding.ASCII.GetBytes(text); |
|
int num = socket.Send(bytes); |
|
socket.Shutdown(SocketShutdown.Both); |
|
socket.Close(); |
|
} |
|
} |
|
}
|
|
|