Started working on pop
This commit is contained in:
parent
354c180b98
commit
789c0377cf
@ -73,7 +73,6 @@ public class BufferedNetworkStackClient {
|
||||
buf.flip();
|
||||
|
||||
try {
|
||||
// System.out.println(Arrays.toString(buf.array()));
|
||||
channel.send(buf, dest);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -87,10 +86,14 @@ public class BufferedNetworkStackClient {
|
||||
}
|
||||
|
||||
InetSocketAddress dest = new InetSocketAddress(host, port);
|
||||
// TODO
|
||||
channel.send(ByteBuffer.wrap("pop".getBytes()), dest);
|
||||
channel.send(ByteBuffer.wrap(new byte[] { CMD_POP }), dest);
|
||||
|
||||
return "pop";
|
||||
channel.receive(buf);
|
||||
byte[] receivedData = buf.array();
|
||||
String strReceived = new String(receivedData).toString().trim();
|
||||
|
||||
System.out.println(strReceived);
|
||||
return strReceived;
|
||||
}
|
||||
|
||||
public void print(String host, int port) throws IOException {
|
||||
|
||||
@ -110,6 +110,7 @@ public class ClientGUI extends JFrame {
|
||||
try {
|
||||
received = client.pop(txtHost.getText(),
|
||||
Integer.valueOf(txtPort.getText()));
|
||||
textPane.setText(textPane.getText() + "\n" + received);
|
||||
} catch (NumberFormatException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (IOException e2) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user