5-COE312 - Socket Programming
5-COE312 - Socket Programming
Socket
Programming
COE312
Omar Arif
Connection Connection-
Connectionless
status oriented
Data
Yes No
sequencing
Guaranteed
Yes No
delivery
Retransmissio No
Retransmissio
n of lost retransmission
n of data
packets of lost packets
Protocols for Extensive
Basic error
communicati Error checking error
checking
checking
on Speed
Slower than
UDP
Faster than
TCP
Broadcasting No Yes
Used by Video
Optimal use HTTPS, HTTP, conferencing,
case SMTP, POP, streaming,
FTP, etc DNS, VoIP, etc
4
Listening to
socket port 23
Client
server
et
sock
Client
Each socket client connects using Each server can form socket
1. IP address connections with multiple
2. Port clients.
9
In other words, servers are like
receptionists who sit by the phone
and wait for incoming calls.
DataOutputStream dout=new
DataOutputStream(s.getOutputStream());
dout.writeUTF("Welcome");
}
}catch(Exception e){
System.out.println(e);
}
}
}
10
Make sure
you can see
the phone
19
int character;
TCP_Client }
System.out.print((char) character);
Main }
}
TCP Client showing sensor data from the phone in 22
JSON format.
24