Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I avoid "Socket Notification Sink" error?

How can I avoid "Socket Notification Sink" error?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rambojanggoon
    wrote on last edited by
    #1

    when I try to "restart system" or "turn off system" , I get error message "Socket Notification Sink" Dialog box. And it didn't work reboot or turn off.. How can I avoid "Socket Notification Sink" error? My main brief code as followings. /* tread will do send something infinitely with 5 second sleep unless it is ended*/ UINT _ThreadDoSomethingInfinite(LPVOID pParam) { char buf[100]; CSocket h_sock; CMyDlg *p=(CMyDlg*)pParam; h_sock.Create( nPort , SOCK_DGRAM); while(1) { Sleep(5000); . . stcpy(buf, "some data..buffering.."); h_sock.SendTo( buf , 1234 , "127.0.0.1" ); } //will never reach... h_sock.ShutDown(2); h_sock.Close(); } CWinThread g_updsock; BOOL CMyDlg::OnInitDialog() g_updsock=AfxBeginThread(_ThreadSendAgentStatus,this,THREAD_PRIORITY_NORMAL); if(g_updsock==NULL) return; }

    M 1 Reply Last reply
    0
    • R rambojanggoon

      when I try to "restart system" or "turn off system" , I get error message "Socket Notification Sink" Dialog box. And it didn't work reboot or turn off.. How can I avoid "Socket Notification Sink" error? My main brief code as followings. /* tread will do send something infinitely with 5 second sleep unless it is ended*/ UINT _ThreadDoSomethingInfinite(LPVOID pParam) { char buf[100]; CSocket h_sock; CMyDlg *p=(CMyDlg*)pParam; h_sock.Create( nPort , SOCK_DGRAM); while(1) { Sleep(5000); . . stcpy(buf, "some data..buffering.."); h_sock.SendTo( buf , 1234 , "127.0.0.1" ); } //will never reach... h_sock.ShutDown(2); h_sock.Close(); } CWinThread g_updsock; BOOL CMyDlg::OnInitDialog() g_updsock=AfxBeginThread(_ThreadSendAgentStatus,this,THREAD_PRIORITY_NORMAL); if(g_updsock==NULL) return; }

      M Offline
      M Offline
      Moak
      wrote on last edited by
      #2

      Hi, I suggest to exit the endless loop when the application is signaled to terminate or an error occured. Add basic error handling to the socket methods, e.g. Create and SendTo return a status. Alternatively use a different socket class than MFC's CSocket or use plain sockets (Winsock). /M

      Webchat in Europe :java: (only 4K)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups