-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathCaller.java
More file actions
41 lines (35 loc) · 1.1 KB
/
Caller.java
File metadata and controls
41 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;
public class Caller {
private final int port = 28411;
private String ip;
private String localNick;
private SocketAddress remoteAddress;
private String remoteNick;
private CallStatus status;
public Caller(){
this.localNick = "unnamed";
this.remoteAddress = getRemoteAddress();
}
public String getLocalNick(){
return localNick;
}
private SocketAddress getRemoteAddress() {
// TODO Auto-generated method stub
return remoteAddress;
}
public Caller(String localNick,SocketAddress remoteAddress){
this.localNick = localNick;
this.remoteAddress = remoteAddress;
}
public Caller(String localNick,String ip){
this.localNick = localNick;
this.ip = ip;
}
public Connection call() throws Exception{
Connection connection = new Connection(new Socket(InetAddress.getByName(ip),port));
return connection;
}
}