Your SlideShare is downloading. ×
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Winsock
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Winsock

499

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
499
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Winsock
  • 2. OutLine
    • Winsock Introduction
    • Project#3 Template
    • MFC CSocket
    • Demo hint
  • 3. Winsock Introduction (See testMain)
    • int APIENTRY _tWinMain(…)
      • main routine
      • make hInstance maps to WndProc
      • while loop for wait message
    • BOOL InitInstance(HINSTANCE , int)
      • CreateWindow
      • Show Window
    • LRESULT CALLBACK WndProc( …)
      • Handle message
  • 4. Winsock Introduction
    • WSAStartup( … )
      • 通知 Windows Sockets 應用程式要開始網路服務
    • WSAAsyncSelect (…)
    • WSACleanup()
      • 結束 Windows Sockets 的使用
    • WSAGETSELECTEVENT(lParam)
      • extract the event code from the lParam in the response to a WSAAsyncSelect()
      • LOWORD(lParam)
  • 5. Events
    • FD_READ:
    • FD_WRITE:
    • FD_CONNECT:
    • FD_ACCEPT:
    • FD_CLOSE:
  • 6. Project#3 Template
    • EditPrintf (HWND hwndEdit, TCHAR * szFormat, ...)
      • EditPrintf(hwndEdit, TEXT("=== Server START === "));
      • EditPrintf(hwndEdit, TEXT("=== Accept one new client(%d), List size:%d === "), ssock, Socks.size());
    • case ID_LISTEN:
      • Press the “Listen” button
      • The button’s ID is “ ID_LISTEN ”
    • WM_USER => 0x0400
      • All Message Numbers below 0x0400 are RESERVED.
  • 7. To Do
    • Fill actions when event happen
    • When FD_READ/FD_WRITE happen ?
      • GET action
      • Target Server I/O
      • Handle them same place ?
    • Handle htm & cgi
  • 8. MFC CSocket
    • 繼承 CSocket 類別
    • 覆寫 OnAccept 等 function
  • 9.  
  • 10.  
  • 11. Demo hint
    • 可以用作業二的任一 Server, 但不能重開
    • 有把握的話 ,Test_case 1&2 可以一起測
    • Delayed server code 和 hide testcase 會在 demo 前幾天公怖
    • Timeout 機制請做成選項 還要說明如何做

×