Network Classes

darkrunic

Member
Joined
Oct 16, 2003
Messages
5
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::Parse("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
 

Similar threads

P
Replies
0
Views
176
Policy standard local admin account with Active Di
P
M
Replies
0
Views
145
MyCatAlex
M
Back
Top