0003-Improve-tcp-connection-establishment_685072f.patch
rsb-cil-test/Program.cs | ||
---|---|---|
12 | 12 |
{ |
13 | 13 |
class MainClass |
14 | 14 |
{ |
15 |
static readonly string host = "localhost";
|
|
15 |
static readonly byte[] host = new byte[] { 127, 0, 0, 1};
|
|
16 | 16 |
static readonly int port = 30010; |
17 | 17 | |
18 | 18 |
public static void PrintEvent(Event theEvent) |
rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs | ||
---|---|---|
6 | 6 |
using Google.Protobuf; |
7 | 7 | |
8 | 8 |
using Rsb.Protocol; |
9 |
using System.Net; |
|
9 | 10 | |
10 | 11 |
namespace Rsb.Transport.Socket |
11 | 12 |
{ |
... | ... | |
17 | 18 |
private static readonly int MESSAGE_LENGTH_SIZE = 4; |
18 | 19 |
private static readonly int MESSAGE_VERSION_SIZE = 4; |
19 | 20 | |
20 |
private String host; |
|
21 |
private int port; |
|
21 |
private IPEndPoint endPoint; |
|
22 | 22 |
private TcpClient client = null; |
23 | 23 |
private NetworkStream stream = null; |
24 | 24 | |
25 |
public BusClientConnection(String host, int port)
|
|
25 |
public BusClientConnection(byte[] ip, int port)
|
|
26 | 26 |
{ |
27 |
this.host = host; |
|
28 |
this.port = port; |
|
27 |
endPoint = new IPEndPoint(new IPAddress(ip), port); |
|
29 | 28 |
} |
30 | 29 | |
31 | 30 |
public void Activate() |
... | ... | |
33 | 32 |
LOGGER.Debug("Activating"); |
34 | 33 | |
35 | 34 | |
36 |
this.client = new TcpClient(host, port); |
|
35 |
this.client = new TcpClient(); |
|
36 |
this.client.Connect(endPoint); |
|
37 | 37 |
this.client.NoDelay = true; |
38 | 38 |
this.stream = client.GetStream(); |
39 | 39 | |
40 |
- |