Click to See Complete Forum and Search --> : help abt managed unmanaged code


r00d0034
August 7th, 2002, 05:07 PM
can any body give me any example where csocket class is used in managed code i will bwe very thank full to u?

may i inherit a class in c-sharp from csocket if yes how i will inherit it plz help mee?

EmeraldMist
September 4th, 2002, 04:46 PM
Here is what I've been using. Hope this helps


m_pSocket = new Socket(_localEndPoint->get_AddressFamily(), SocketType::Dgram, ProtocolType::Udp);

m_pSocket->Bind(_localEndPoint);


m_pSocket->SetSocketOption(SocketOptionLevel::IP,
SocketOptionName::AddMembership,
new MulticastOption( _remoteEndPoint->Address));


//Sending
if(m_pSocket->Connected == false)
m_pSocket->Connect(_remoteEndPoint);
m_pSocket->Send(buf);

//receiving
nNumOfBytesReceived = m_pSocket->ReceiveFrom(buf, &epRef);