Hi all,

I have a class UDPSocket inherited from .Net class 'UdpClient', Its code is as follows:

class UDPSocket : UdpClient
{
public UDPSocket()
{ }

public UDPSocket(int port)
{ }

public UDPSocket(IPEndPoint ep)
{ }

~UDPSocket()
{ }
}



There is also a CommunicationMgr class, which has the object of UDPSocket class, and is used for sending and receiving data from the socket. the code is given below:

public class CommunicationMgr
{
UDPSocket m_Socket;
IPAddress m_IPAddress;


public CommunicationMgr()
{
m_IPAddress = IPAddress.Parse("10.99.8.100");
m_Socket = new UDPSocket(1000);
}

~CommunicationMgr()
{ }


public void OnRequest()
{
IPEndPoint ipEndPoint = new IPEndPoint(m_IPAddress, 1000);
byte[] data = new byte[] { 0xbb, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xfb };
int datalength = data.Length;
int tt = m_Socket.Send(data, datalength, ipEndPoint);

}

public void OnResponse()
{
IPEndPoint remoteIpEndPoint = new IPEndPoint(ip, 1000);
byte[] receiveBytes = m_Socket.Receive(ref remoteIpEndPoint);
}



The application hangs at the receive function given below:
byte[] receiveBytes = m_Socket.Receive(ref remoteIpEndPoint);

Please note that if the same code is used with UdpClient class (ie, its object) instead of using object of the user-defined class UDPSocket then the application works!!!.
Can somebody please tell me what is wrong here??? Should i do anything in the UDPSocket's constructor?????


Regards
Daffodils180