Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
587 B
1
Indexable
Never
import java.net.*;
import java.io.*;
class tcpClientPrime
{
public static void main(String args[])
{
try
{
Socket cs = new Socket("LocalHost",8001);
BufferedReader infu = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a number : ");
int a = Integer.parseInt(infu.readLine());
DataOutputStream out = new DataOutputStream(cs.getOutputStream());
out.writeInt(a);
DataInputStream in = new
DataInputStream(cs.getInputStream());
System.out.println(in.readUTF()); cs.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}