Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.net.*;
- import java.io.*;
- public class Main {
- public static void main(String[] args) {
- Socket socket =null;
- Socket socket1 = null;
- Socket socket2 = null;
- Socket socket3 = null;
- try {
- socket = new Socket("wp.pl", 80);
- socket1 = new Socket("onet.pl", 80);
- socket2 = new Socket("ug.gda.pl", 80);
- socket3 = new Socket("interia.pl", 80);
- }
- catch(UnknownHostException e) {
- System.out.println(e);
- }
- catch(IOException e) {
- System.out.println(e);
- }
- if(socket!=null) {
- System.out.println(socket);
- }
- if(socket1!=null) {
- System.out.println(socket1);
- }
- if(socket2!=null) {
- System.out.println(socket2);
- }
- if(socket3!=null) {
- System.out.println(socket3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement