{simple} Exception handling & Object references

G

Guest

I have this line of code I want to know where to put it in my code (basically so any private function using clientSocket.Send or clientSocket.Receive will accept it):

Socket clientSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp );

so that this line of code (which is in a private function that gets called when a button is clicked):

clientSocket.Connect(new IPEndPoint(IPAddress.Parse("xx.xxx.xx.xxx"),xxxx));

won't throw this exception:

Object reference not set to an instance of an object.

I'm new to c# and would appreciate the help.

TIA, Nate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top