diff options
Diffstat (limited to 'Dozentenmodul/src/thrift/MasterThriftConnection.java')
| -rw-r--r-- | Dozentenmodul/src/thrift/MasterThriftConnection.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Dozentenmodul/src/thrift/MasterThriftConnection.java b/Dozentenmodul/src/thrift/MasterThriftConnection.java new file mode 100644 index 00000000..ecbc689c --- /dev/null +++ b/Dozentenmodul/src/thrift/MasterThriftConnection.java @@ -0,0 +1,38 @@ +package thrift; + +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; + +import thrift.ImageServer.Client; + + + +public class MasterThriftConnection { + final TTransport transport = new TSocket("132.230.4.16", 9090); + public Client getMasterThriftConnection() + { + + try { + transport.open(); + } catch (TTransportException e) { + System.out.println("Keine Verbindung möglich!"); + return null; + } + + final TProtocol protocol = new TBinaryProtocol(transport); + final Client client = new Client(protocol); + + + System.out.println("Der Server läuft!"); + + return client; + } + + public void closeMasterThriftConnection() + { + transport.close(); + } +} |
