VirtualBox Hosted Cosmos не получает IP с мобильной точкой доступаC#

Место общения программистов C#
Ответить
Anonymous
 VirtualBox Hosted Cosmos не получает IP с мобильной точкой доступа

Сообщение Anonymous »

Я принимаю ОС NAS с Cosmos и Oracle VirtualBox с VS 2022 C#. Но, к сожалению, каким -то образом он не получает IP -адрес с мобильной точкой доступа тем временем работает через Wi -Fi из дома. В настройках сети я использую мосточный адаптер с типом адаптера Intel Pro /1000 MT (82540EM).using Cosmos.System.Network.Config;
using Cosmos.System.Network.IPv4;
using Cosmos.System.Network.IPv4.UDP.DHCP;
// using CosmosFtpServer;
using CosmosTest.App.HttpServer;
using System;
using System.Threading;

namespace CosmosTest.App
{
internal class Application
{
private Network network;
public Application(Network network)
{
this.network = network;
Console.WriteLine("Application: Constructor started.");
Console.WriteLine("Application: Starting DHCP...");
Console.WriteLine("Application: DHCP process finished. IP acquired.");
Console.WriteLine("Application: Initializing TcpServer (HTTP)...");
new TcpServer(80);
Console.WriteLine("Application: Initializing FtpServer...");
new FtpServer();

Console.WriteLine("Application: All servers initialized.");

}
}
}
< /code>
И это мой kernel.cs: < /p>
using CosmosTest.App;
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Sys = Cosmos.System;

namespace CosmosTest
{
public class Kernel : Sys.Kernel
{
private Network network = null!;
protected override void BeforeRun()
{
Console.Clear();
Console.WriteLine("\r\n\r\n ________ ________ ________ \r\n|\\ ___ \\|\\ __ \\|\\ ____\\ \r\n\\ \\ \\\\ \\ \\ \\ \\|\\ \\ \\ \\___|_ \r\n \\ \\ \\\\ \\ \\ \\ __ \\ \\_____ \\ \r\n \\ \\ \\\\ \\ \\ \\ \\ \\ \\|____|\\ \\ \r\n \\ \\__\\\\ \\__\\ \\__\\ \\__\\____\\_\\ \\ \r\n \\|__| \\|__|\\|__|\\|__|\\_________\\\r\n \\|_________|\r\n\r\n");
network = new Network();
if(!network.Initialize())
{
Console.WriteLine("Press any key to restart");
Console.ReadKey();
Sys.Power.Reboot();
}
}

protected override void Run()
{
try
{
new Application(network);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Sys.Power.Reboot();
}
string input = Console.ReadLine();
if(input == "x")
{
Sys.Power.Shutdown();
}
}
}
}
< /code>
И это моя network.cs: < /p>
using Cosmos.System.Network.Config;
using Cosmos.System.Network.IPv4.UDP.DHCP;
using System;
using System.Threading;

namespace CosmosTest.App
{
internal class Network
{
internal Network()
{

}
internal bool Initialize()
{
int attempts = 0;
Console.Write("Network Initializing");
using (var xClient = new DHCPClient())
{
while (attempts < 5)
{
if(xClient.SendDiscoverPacket()>=0)
{
Console.WriteLine("done");
Console.WriteLine("IP-Address: "+NetworkConfiguration.CurrentAddress.ToString());
return true;
}
Thread.Sleep(1000);
Console.Write(".");
attempts++;
}
}
Console.WriteLine("failed");
return false;
}
}
}


Подробнее здесь: https://stackoverflow.com/questions/796 ... le-hotspot
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»