Started working on pop

This commit is contained in:
senft-lap 2012-11-06 14:08:42 +01:00
parent 354c180b98
commit 789c0377cf
2 changed files with 8 additions and 4 deletions

View File

@ -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 {

View File

@ -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) {