Add a main for FileSender. It now works we can use this little class for more
test.
--- a/src/com/beem/project/beem/jingle/FileSender.java Thu Mar 12 22:27:36 2009 +0100
+++ b/src/com/beem/project/beem/jingle/FileSender.java Thu Mar 12 23:26:27 2009 +0100
@@ -28,12 +28,15 @@
OutputStream out = new BufferedOutputStream(sock.getOutputStream());
try {
+ // peut etre se debarasser de started
started = true;
byte buf[] = new byte[1024];
int nbbytes = 1;
- while (started && nbbytes != -1){
+ while (started){
nbbytes = in.read(buf, 0, 1024);
- out.write(buf, 0, 1024);
+ if (nbbytes == -1)
+ break;
+ out.write(buf, 0, nbbytes);
}
started = false;
} finally {
@@ -55,5 +58,10 @@
started = false;
}
+ public static void main(String args[]) throws InterruptedException {
+ FileSender fs = new FileSender("localhost", 4242, "/tmp/img.jpeg");
+ fs.start();
+ fs.join();
+ }
}