Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Pertemuan 9 Windows Socket ( WinSock ) Matakuliah: H0483 – Network Programming Tahun: 2008 Versi: 2.0.

Similar presentations


Presentation on theme: "1 Pertemuan 9 Windows Socket ( WinSock ) Matakuliah: H0483 – Network Programming Tahun: 2008 Versi: 2.0."— Presentation transcript:

1 1 Pertemuan 9 Windows Socket ( WinSock ) Matakuliah: H0483 – Network Programming Tahun: 2008 Versi: 2.0

2 2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : Mendemokan program aplikasi pada sistem operasi windows dengan menggunakan Windows Socket.

3 3 Outline Materi What is Socket ? What is Winsock ? The Socket History Winsock History Supported Programming Models Elements of Winsock Programming General Program Flow Iterative Server pada Windows Concurrent Server pada Windows

4 4 WinSock What is Socket? –Socket is is a programming model originally designed for network programming under UNIX operating systems. What is Winsock? –Winsock stands for Windows Socket; –An Application Programming Interface for network programming under the Microsoft Windows operating systems. –It is modeled after UNIX Socket but with platform-specific features added.

5 5 WinSock

6 6

7 7

8 8 Supported Programming Models –Synchronous Model –Asynchronous Model Synchronous Model –Makes use of blocking-mode I/O function calls. –What is Blocking I/O? Guaranteed either function completed successfully or failed upon function return The calling code has to wait (i.e. block) for the function to complete before continuing execution

9 9 WinSock Asynchronous Model –Makes use of non-blocking-mode I/O function calls. What is Non-Blocking I/O? –Guaranteed function will return immediately: –The calling code has to check if the function has completed before return. –If not, the calling code will have to handle that itself.(e.g. check at a later time, call the function again, wait for asynchronous event to trigger, etc.)

10 10 Elements of Winsock Programming

11 11 Elements of Winsock Programming BSD-Style Winsock Functions –Core functions accept, bind, closesocket, connect, listen, recv, recvfrom, select, send, sendto, Shutdown, socket –Auxiliary functions Getpeername, Getsockname, Getsockopt, ioctlsocket –Utility functions htonl, htons, inet_addr, inet_ntoa, ntohl, ntohs

12 12 Elements of Winsock Programming Windows-Specific Winsock Functions –Core functions WSAStartup, WSACleanup, WSAAsyncGettByn, WSAAsyncSelect, WSACancelAsyncRequest, WSAConnect,WSAIoctl, WSARecv, WSARecvFrom, WSASend, WSASendTo, WSASocket –Auxiliary functions WSADuplicateSocket, WSAEnumNetworkEvents, WSAEnumProtocols, WSAGetLastError, WSAGetQOSByName, WSAHtonl, WSAHtons, WSAJoinLeaf, WSANtohl, WSANtohs, WSAProviderConfigChange, WSASetLastError –Supporting functions WSACloseEvent, WSACreateEvent, WSAEventSelect, WSAGetOverlappedResult, WSAResetEvent, WSASetEvent, WSAWaitForMultipleEvents

13 13 General Program Flow

14 14 General Program Flow

15 15 General Program Flow

16 16 Online References References –The Winsock 1.1 and 2.0 Specifications –Winsock Resource Centre at http://www.winsock.com –Windows socket programming resources at http://www.sockets.com –Visual C++ On-Line Help and Programming Reference

17 17 Iterative Server pada Windows

18 18 Concurrent Server pada Windows

19 19 Concurrent Servers I/O Models for Concurrent Servers –Synchronous/Blocking Mode I/O Multi-threading (Win32 only) Similar to the UNIX fork( ) multiple-process model. –Asynchronous/Non-Blocking Mode I/O Message-driven (All Windows versions) Overlapped I/O (Win32 only) –Socket handle signalling –Windows event object signalling –I/O completion routines –I/O Completion Ports (Windows NT only)

20 20 Concurrent Server pada Windows

21 21 Concurrent Server pada Windows

22 22 Concurrent Server pada Windows

23 23 Concurrent Server pada Windows

24 24 Concurrent Server pada Windows

25 25 Latihan Buat Program Echo Server dan program client nya pada Windows dengan menggunakan Winsock. Bahasa Pemrograman yang digunakan bebas.


Download ppt "1 Pertemuan 9 Windows Socket ( WinSock ) Matakuliah: H0483 – Network Programming Tahun: 2008 Versi: 2.0."

Similar presentations


Ads by Google