Nt1310 Unit 5 Assignment

Words: 963
Pages: 4

NETWORK PROGRAMMING Morning batch: group no: 15 Madhumitha Chinthireddy (w929716) Anupama Reshepu Gollapudi (w929787)

Network programming can be defined as schedule of programs on a network to perform communication. Sockets play very important role in network programming .Java supports network programming to communicate with other machines.
Socket network programming provides the communication mechanism between computers using the network sockets.
Sockets:
Sockets are used for inter communication process. It is the process
…show more content…
It is programming language independent, therefore a socket program written in Java language can also communicate to a program written in Java or non-Java socket program.
Socket communication:
A server program has a socket that is bound to a specific port and runs on a specific computer. To make a connection request the server waits and listens to the socket for a client.
The server accepts the connection. Now, the server gets a new socket bounds to a different port. It needs a new socket because it can continue to listen to the original socket for connection requests while serving the connected
…show more content…
Datagram methods:
Void connect(inet address,int port); Used to connect with the server, where there are two parameters address of client and port number.
Void close(): Used to close the connection, which is zero parameterized.
Void receive(DatagramPacket p): Use to receive the data from server by Datagram packet reference object
Void send(DatagramPacket p): Used to send the data to server by Datagram packet reference object.

Client Sockets
The sockets which are binded on the clent side are said to be Client Sockets.
Socket(String remoteHost, int remotePort) :Creates a TCP socket and connects it to the remote host on the remote port (hand shake)
Write and read operations: InputStream getInputStream() and OutputStream getOutputStream()

Server Socket
A server socket waits for requests across the network, operations are performed based on the request and then possibly returns a result to the