source: ntrip/trunk/GnssCenter/thrift/bidi_java/server/MessageServiceClient.java@ 6682

Last change on this file since 6682 was 4940, checked in by mervart, 12 years ago
File size: 1.2 KB
Line 
1package com.joelpm.bidiMessages.server;
2
3import org.apache.thrift.TException;
4import org.apache.thrift.protocol.TBinaryProtocol;
5import org.apache.thrift.transport.TSocket;
6import org.apache.thrift.transport.TTransport;
7import com.joelpm.bidiMessages.generated.Message;
8import com.joelpm.bidiMessages.generated.MessageService;
9import com.joelpm.bidiMessages.generated.MessageService.Iface;
10
11/**
12* This class is a stub that the server can use to send messages back
13* to the client.
14*
15* @author Joel Meyer
16*/
17public class MessageServiceClient implements Iface {
18 protected final TTransport transport;
19 protected final String addy;
20 protected final int port;
21 protected final MessageService.Client client;
22
23 public MessageServiceClient(TTransport transport) {
24 TSocket tsocket = (TSocket)transport;
25 this.transport = transport;
26
27 this.client = new MessageService.Client(new TBinaryProtocol(transport));
28 this.addy = tsocket.getSocket().getInetAddress().getHostAddress();
29 this.port = tsocket.getSocket().getPort();
30
31 }
32
33 public String getAddy() {
34 return addy;
35 }
36
37 public void sendMessage(Message msg) throws TException {
38 this.client.sendMessage(msg);
39 }
40}
41
Note: See TracBrowser for help on using the repository browser.