new method to query client ip
This commit is contained in:
1 parent
38958bad95
commit
3b43758054
4 files changed
+76
-9
No files matched your search
@@ -21,12 +21,12 @@ int myExternalPort = -1;
|
||||
bool running = true;
|
||||
bool connected = false;
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
foreach (var lobbyEvent in lobbyClient.ReadEvents(20))
|
||||
{
|
||||
{
|
||||
switch (lobbyEvent.EventType)
|
||||
{
|
||||
case LobbyClientEventTypes.Connected:
|
||||
@@ -80,7 +80,7 @@ _ = Task.Run(async () =>
|
||||
Console.WriteLine($"Direct connection to {result.IPAddress!.ToString()} possible, using direct connection!");
|
||||
Console.WriteLine($"Connecting game client!");
|
||||
fakeGameHost.Send(new IPEndPoint(result.IPAddress!, currentLobbyHostInfo!.HostPort), "Hello from Game Client!");
|
||||
Console.Write(">");
|
||||
Console.Write(">");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -130,9 +130,9 @@ _ = Task.Run(async () =>
|
||||
|
||||
var p = Console.GetCursorPosition();
|
||||
Console.SetCursorPosition(0, p.Top);
|
||||
Console.WriteLine($"Received my external ip {seenExternalIpAndPort!.Ip}:{seenExternalIpAndPort.Port}");
|
||||
Console.WriteLine($"Received my external ip {seenExternalIpAndPort!.Ip}:{seenExternalIpAndPort.Port}");
|
||||
Console.Write(">");
|
||||
|
||||
|
||||
connected = true;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,8 @@ _ = Task.Run(async () =>
|
||||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
lobbyClient.QueryExternalIpAndPort((remoteEndpoint, messageData, messageLength) => {
|
||||
lobbyClient.QueryExternalIpAndPort((remoteEndpoint, messageData, messageLength) =>
|
||||
{
|
||||
fakeGameHost.Send(remoteEndpoint, messageData, messageLength);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user