Download The write up here
//-----AT CLIENT SIDE------import java.lang.System;
import java.net.*;
import java.io.*;
public class Client {
static Socket connection;
public static void main(String a[]) throws SocketException {
try {
int v[] = new int[9];
//int g[] = new int[8];
int n = 0;
InetAddress addr = InetAddress.getByName('Localhost');
System.out.println(addr);
connection = new Socket(addr, 8011);
DataOutputStream out = new DataOutputStream(
connection.getOutputStream());
DataInputStream in = new DataInputStream(
connection.getInputStream());
int p = in.read();
System.out.println('No of frame is:' + p);
for (int i = 0; i < p; i++) {
v[i] = in.read();
System.out.println(v[i]);
//g[i] = v[i];
}
v[5] = -1;
for (int i = 0; i < p; i++)
{
System.out.println('Received frame is: ' + v[i]);
}
for (int i = 0; i < p; i++)
if (v[i] -1) {
System.out.println('Request to retransmit packet no '
+ (i+1) + ' again!!');
n = i;
out.write(n);
out.flush();
}
System.out.println();
v[n] = in.read();
System.out.println('Received frame is: ' + v[n]);
System.out.println('quiting');
} catch (Exception e) {
System.out.println(e);
}
}
}
/* OUTPUT
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ javac Client.java
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ java Client
Localhost/127.0.0.1
No of frame is:9
30
40
50
60
70
80
90
100
110
Received frame is: 30
Received frame is: 40
Received frame is: 50
Received frame is: 60
Received frame is: 70
Received frame is: -1
Received frame is: 90
Received frame is: 100
Received frame is: 110
Request to retransmit packet no 6 again!!
Received frame is: 80
quiting
iotlab@iotlab-Veriton-M200-B360:~/sliding window$
*/
//-----AT SERVER SIDE-----
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
public class Server {
static ServerSocket Serversocket;
static DataInputStream dis;
static DataOutputStream dos;
public static void main(String[] args) throws SocketException {
try {
int a[] = { 30, 40, 50, 60, 70, 80, 90, 100, 110 };
Serversocket = new ServerSocket(8011);
System.out.println('waiting for connection');
Socket client = Serversocket.accept();
dis = new DataInputStream(client.getInputStream());
dos = new DataOutputStream(client.getOutputStream());
System.out.println('The number of packets sent is:' + a.length);
int y = a.length;
dos.write(y);
dos.flush();
for (int i = 0; i < a.length; i++) {
dos.write(a[i]);
dos.flush();
}
int k = dis.read();
dos.write(a[k]);
dos.flush();
} catch (IOException e) {
System.out.println(e);
} finally {
try {
dis.close();
dos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
/*OUTPUT
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ javac Server.java
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ java Server
waiting for connection
The number of packets sent is:9
iotlab@iotlab-Veriton-M200-B360:~/sliding window$
*/
Windows Socket Programming
Java Socket programming can be connection-oriented or connection-less. Wwe smackdown here comes the pain highly compressed for android. Socket and ServerSocket classes are used for connection-oriented socket programming and DatagramSocket and DatagramPacket classes are used for connection-less socket programming. The client in socket programming must know two information: IP Address of Server, and; Port number.
Lauryn hill the miseducation of lauryn hill zip album download. The Miseducation Of Lauryn Hill. Released in 1998.
Installing
Download The write up here
//-----AT CLIENT SIDE------import java.lang.System;
import java.net.*;
import java.io.*;
public class Client {
static Socket connection;
public static void main(String a[]) throws SocketException {
try {
int v[] = new int[9];
//int g[] = new int[8];
int n = 0;
InetAddress addr = InetAddress.getByName('Localhost');
System.out.println(addr);
connection = new Socket(addr, 8011);
DataOutputStream out = new DataOutputStream(
connection.getOutputStream());
DataInputStream in = new DataInputStream(
connection.getInputStream());
int p = in.read();
System.out.println('No of frame is:' + p);
for (int i = 0; i < p; i++) {
v[i] = in.read();
System.out.println(v[i]);
//g[i] = v[i];
}
v[5] = -1;
for (int i = 0; i < p; i++)
{
System.out.println('Received frame is: ' + v[i]);
}
for (int i = 0; i < p; i++)
if (v[i] -1) {
System.out.println('Request to retransmit packet no '
+ (i+1) + ' again!!');
n = i;
out.write(n);
out.flush();
}
System.out.println();
v[n] = in.read();
System.out.println('Received frame is: ' + v[n]);
System.out.println('quiting');
} catch (Exception e) {
System.out.println(e);
}
}
}
/* OUTPUT
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ javac Client.java
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ java Client
Localhost/127.0.0.1
No of frame is:9
30
40
50
60
70
80
90
100
110
Received frame is: 30
Received frame is: 40
Received frame is: 50
Received frame is: 60
Received frame is: 70
Received frame is: -1
Received frame is: 90
Received frame is: 100
Received frame is: 110
Request to retransmit packet no 6 again!!
Received frame is: 80
quiting
iotlab@iotlab-Veriton-M200-B360:~/sliding window$
*/
//-----AT SERVER SIDE-----
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
public class Server {
static ServerSocket Serversocket;
static DataInputStream dis;
static DataOutputStream dos;
public static void main(String[] args) throws SocketException {
try {
int a[] = { 30, 40, 50, 60, 70, 80, 90, 100, 110 };
Serversocket = new ServerSocket(8011);
System.out.println('waiting for connection');
Socket client = Serversocket.accept();
dis = new DataInputStream(client.getInputStream());
dos = new DataOutputStream(client.getOutputStream());
System.out.println('The number of packets sent is:' + a.length);
int y = a.length;
dos.write(y);
dos.flush();
for (int i = 0; i < a.length; i++) {
dos.write(a[i]);
dos.flush();
}
int k = dis.read();
dos.write(a[k]);
dos.flush();
} catch (IOException e) {
System.out.println(e);
} finally {
try {
dis.close();
dos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
/*OUTPUT
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ javac Server.java
iotlab@iotlab-Veriton-M200-B360:~/sliding window$ java Server
waiting for connection
The number of packets sent is:9
iotlab@iotlab-Veriton-M200-B360:~/sliding window$
*/
Windows Socket Programming
Java Socket programming can be connection-oriented or connection-less. Wwe smackdown here comes the pain highly compressed for android. Socket and ServerSocket classes are used for connection-oriented socket programming and DatagramSocket and DatagramPacket classes are used for connection-less socket programming. The client in socket programming must know two information: IP Address of Server, and; Port number.
Lauryn hill the miseducation of lauryn hill zip album download. The Miseducation Of Lauryn Hill. Released in 1998.
Installing
Sliding Window Protocol In Network Programming
- Output: enter the windows size: 10 sender window is expanded to store message or window enter the data to be sent: forgetcode.com message send by the sender: forgetcode.com window size of receiver is expanded acknowledgement from receiver ack:5 message received by receiver is: forgetcode window size of receiver is shrinked.
- Program to find prime nos in c; program to find prime nos in shell script; to calculate the characters,words and line in a se. Program to display table of number; program to display screen handling; display the sum and reverse of a number using whil. To demonstrate nested if else using shell scripting. To find if nos are equal or not.