Cameron Weinfurt 2 years ago
parent
commit
e56eb43229
  1. 14
      proto/ProtoOut.java
  2. 1
      sample/Main.java

14
proto/ProtoOut.java

@ -43,7 +43,7 @@ public class ProtoOut
out.write(nameBytes);
}
public void sendJoin(String username) throws IOException
synchronized public void sendJoin(String username) throws IOException
{
out.writeByte(ProtoID.JOIN.b);
out.writeInt(0);
@ -51,7 +51,7 @@ public class ProtoOut
commit();
}
public void sendPart(String username) throws IOException
synchronized public void sendPart(String username) throws IOException
{
out.writeByte(ProtoID.PART.b);
out.writeInt(0);
@ -59,7 +59,7 @@ public class ProtoOut
commit();
}
public void requestUserList(String username) throws IOException
synchronized public void requestUserList(String username) throws IOException
{
out.writeByte(ProtoID.LISTING.b); // type: listing
out.writeInt(0); // length
@ -67,7 +67,7 @@ public class ProtoOut
commit(); // Make it so!
}
public void giveUserListing(String username, String names[]) throws IOException
synchronized public void giveUserListing(String username, String names[]) throws IOException
{
out.writeByte(ProtoID.LISTING.b);
// I can recognize bad code when I write it, and this is bad code.
@ -80,7 +80,7 @@ public class ProtoOut
commit();
}
public void sendMessage(String username, String message) throws IOException
synchronized public void sendMessage(String username, String message) throws IOException
{
out.writeByte(ProtoID.MESSAGE.b);
byte msgb[] = message.getBytes("UTF-8");
@ -89,7 +89,7 @@ public class ProtoOut
out.write(msgb);
}
public void sendFile(String username, String filename, byte data[]) throws IOException
synchronized public void sendFile(String username, String filename, byte data[]) throws IOException
{
out.writeByte(ProtoID.FILE.b);
byte fnb[] = filename.getBytes("UTF-8");
@ -102,7 +102,7 @@ public class ProtoOut
out.write(data);
}
public void sendInfo(String username) throws IOException
synchronized public void sendInfo(String username) throws IOException
{
// TODO
throw new IOException("not implemented");

1
sample/Main.java

@ -4,7 +4,6 @@ import proto.ProtoHandler;
import proto.ProtoIn;
import proto.ProtoOut;
import java.awt.desktop.OpenURIEvent;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

Loading…
Cancel
Save