Ok so first things first, here is the error i'm getting and then i'll post the code below it where the error happens:
No overload for method 'EndReceive' takes '0' arguments (CS1501) - C:\Documents and Settings\Administrator\My Documents\SharpDevelop Projects\SPiN\SPiN\MainForm.cs:82,15
here is the line it highlights:
and here is the entire sub:Code:int iRx = theSockId.thisSocket.EndReceive();
here is where this sub is defined to be the handler:Code:public void OnDataReceived(IAsyncResult asyn) { try { SocketPacket theSockId = (SocketPacket)asyn.AsyncState; int iRx = theSockId.thisSocket.EndReceive(); char[] chars = new char[iRx + 1]; System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder(); int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0); System.String szData = new System.String(chars); txtLog.AppendText(szData); WaitForData(); } catch (ObjectDisposedException ) { txtLog.AppendText("OnDataReceived: Socket has been closed."); } catch (SocketException se) { txtLog.AppendText(se.Message); } }
So if anyone knows how to fix this, it would be awesome because i cant figure it out.Code:public void WaitForData() { try { if (m_pfnCallback==null) { m_pfnCallback = new AsyncCallback (OnDataReceived); } SocketPacket theSocPkt = new SocketPacket(); theSocPkt.thisSocket = m_clientSocket; m_result = m_clientSocket.BeginReceive(theSocPkt.dataBuffer, 0, theSocPkt.dataBuffer.Length,SocketFlags.None, m_pfnCallback, theSocPkt); } catch (SocketException se) { txtLog.AppendText(se.Message); } }




Reply With Quote
