darkrunic Posted October 21, 2003 Posted October 21, 2003 Hello all, I'm working on getting some server/client object classes set up and I'm having some odd issues. My connection works fine when I've got all the code just sitting out in main, but when I've 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 Quote
Administrators PlausiblyDamp Posted October 22, 2003 Administrators Posted October 22, 2003 What does the main subroutine look like? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.