עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה עם IOCP ב C#

Featured Replies

פורסם

אני נסיתי לקשר בין HANDLE של SOCKET לIOCP ושאני בודק אם זה הצליח זה אומר שזה הצליח לעשות את זה

אבל שהקליינט שולח מידע לא קורה כלום שאני קורא לפונקציה GetQueuedCompletionStatus היא לא מחזירה כלום כיאלו שום דבר לא נשלח

ככה אני מקשר:


public void BindHandle(IntPtr hFile,int dwCompletionPort)
{
uint h;
unsafe{
h = NativeMethods.CreateIoCompletionPort((uint)hFile, m_IOCPHandle, (uint*)dwCompletionPort,0);

}
if (h != m_IOCPHandle)
throw new Exception("Cannot Bind this handle");
}

וזה הפונקציה של התרד:


private void IOCPFunction()
{

bool CompletionStatus;
Int32 iValue=0;
UInt32 size = 0;
try
{
while (!m_bDisposed)
{
unsafe
{
OVERLAPPED* overLapped;
CompletionStatus = NativeMethods.GetQueuedCompletionStatus(m_IOCPHandle, &size, (uint*)&iValue, &overLapped, NativeMethods.INIFINITE);

if (iValue == NativeMethods.SHUTDOWN_IOCPTHREAD)
{
Interlocked.Decrement(ref m_iActiveThreads);
break;
}
try
{
OnIOCP(iValue);
}
catch(Exception ex)
{
throw ex;
}
}

}
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}

האם אני עושה משהו לא נכון?

פורסם

המימוש הפנימי של BeginXXX ב Sockets לא מספיק טוב לך (הוא משתמש ב IOCP בצורה כלשהי מובנית)?

פורסם
  • מחבר

לא

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.