hmm, wie wäre es damit; so als ansatz!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace Esskar {
public class TcpSocket : Socket
{
public TcpSocket()
: base(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) { }
public void Bind(IPAddress address, int port)
{
Bind(new IPEndPoint(address, port));
}
public void Listen()
{
Listen(5);
}
public int Send(string str) {
return this.Send(str, Encoding.ASCII);
}
public int Send(string str, Encoding enc) {
byte[] sendBytes = enc.GetBytes(str);
return this.Send(sendBytes);
}
}
}