PEMOGRAMAN BERBASIS JARINGAN Ilustrasi C-S Computing a client, a server, and network Client Server Network Client machine Server machine Memahami Port  Protokol TCP dan UDP menggunakan port untuk mengumpulkan data dari komputer jaringan. server P o r t app app app app port port port port TCP Client TCP or.

Report
PEMOGRAMAN BERBASIS JARINGAN
Ilustrasi C-S Computing
a client, a server, and network
Client
Server
Network
Client machine
Server machine
2
Memahami Port

Protokol TCP dan
UDP menggunakan
port untuk
mengumpulkan data
dari komputer
jaringan.
server
P
o
r
t
app
app
app
app
port
port
port
port
TCP
Client
TCP or UDP
Packet
Data
3
port#
data
Memahami Port
Port sebuah terminal virtual yang
digambarkan dengan sebuah Nilai (integer)
sebagai tempat keluar masuk data
 Beberapa port telah direkomendasikan
sebagai sebuah services antara lain :






4
ftp
telnet
smtp
login
21/tcp
23/tcp
25/tcp
513/tcp
User level process/services generally use
port number value >= 1024
Sockets


Sockets provide an interface for programming
networks at the transport layer.
Network communication using Sockets is very
much similar to performing file I/O
 In fact, socket handle is treated like file handle.
 The streams used in file I/O operation are also applicable
to socket-based I/O

Socket-based communication is programming
language independent.
 That means, a socket program written in Java language
can also communicate to a program written in Java or
non-Java socket program.
5
Socket Communication

A server (program) runs on a specific
computer and has a socket that is bound
to a specific port. The server waits and
listens to the socket for a client to make
a connection request.
6
port
server
Connection request
Client
Socket Communication
If everything goes well, the server accepts the
connection. Upon acceptance, the server gets a
new socket bounds to a different port. It needs a
new socket (consequently a different port number)
so that it can continue to listen to the original
socket for connection requests while serving the
connected client.
port
7
port
server
port

Connection
Client
Implementasi PHP Sockets
Server
ServerSocket(8000)
Output/write stream
Client
Input/read stream
8
Socket(“127.0.0.1”, 8000)
It can be host_name like “informatika.itp.ac.id”
Contoh Implementasi PHP dalam
Pemograman Sockets
Buatlah file :
- stream_server.php
- stream_client.php
- formsockclient.php
 Buka browser, lalu aktifkan
stream_server.php, buka browser lain
aktifkan formsockclient.php

Tugas Kelompok
Buatlah program Chatting LAN /
program Chatting berbasis pemograman
jaringan
 Buatkan laporan hardcopy atas tugas
ini.
 Masing-masing kelompok akan
dilakukan pengujian atas tugas nya.


similar documents