Hello all,
Im working on getting some server/client object classes set up and Im having some odd issues. My connection works fine when Ive got all the code just sitting out in main, but when Ive got it set up like it is, it throws the exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at System.Net.Sockets.Socket.get_CleanedUp()
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at main()
my classes are:
__gc public class Server
{
static Socket* socket = new Socket(AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp);
static String* localhost = Dns::GetHostName();
static IPHostEntry* host_entry = Dns::Resolve(localhost);
static IPAddress* ip = host_entry->AddressList[0];
static IPEndPoint* end_point = new IPEndPoint(ip,1337);
void Listen();
};
__gc public class Client
{
static Socket* socket = new Socket(AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp);
static IPAddress* ip = IPAddress:arse("12.208.172.197");
static IPEndPoint* end_point = new IPEndPoint(ip,1337);
void Connect();
};
Can someone possibly point me to the error in my ways? Thanks!
Brian
Im working on getting some server/client object classes set up and Im having some odd issues. My connection works fine when Ive got all the code just sitting out in main, but when Ive got it set up like it is, it throws the exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at System.Net.Sockets.Socket.get_CleanedUp()
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at main()
my classes are:
__gc public class Server
{
static Socket* socket = new Socket(AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp);
static String* localhost = Dns::GetHostName();
static IPHostEntry* host_entry = Dns::Resolve(localhost);
static IPAddress* ip = host_entry->AddressList[0];
static IPEndPoint* end_point = new IPEndPoint(ip,1337);
void Listen();
};
__gc public class Client
{
static Socket* socket = new Socket(AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp);
static IPAddress* ip = IPAddress:arse("12.208.172.197");
static IPEndPoint* end_point = new IPEndPoint(ip,1337);
void Connect();
};
Can someone possibly point me to the error in my ways? Thanks!
Brian