class Program
{
static Socket m_sock;
static void Main(string[] args)
{
Socket m_sock= new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
.
.
.
m_sock.Connect(ipendLocalhost);
SendRequest("command");
}
static void SendRequest(string sCommand)
{
.
.
**m_sock.Send(szCommand, iBytesToSend, SocketFlags.None);**
}
When it comes to Send method I get NullReferenceException. In debug (I added m_sock to watch) I See that when program enters SendRequest method m_sock becomes null. I can't understand why is it happening and where the problem is. Please help.