MultiThreaded Socket Server
Java Code
+ 0 likes
Please Register to submit score.
| Average Score | 0.0 (of 0 scores) |
| Date Added | Aug 03, 2009 |
| Last Updated | Aug 03, 2009 |
| Tags | client java multithread server socket thread |
Introduction
| Code: |
| ServerSocket ssock = new ServerSocket(9899); |
Change the 9899 to whichever port you wish this to listen on.
If you look further down, you'll see:
| Code: |
| if ((int) temp == 1) { |
Now this is for the server to understand the end of a string (using read() only reads on more char so it's difficult to understand when it's done reading). This (the 1 in the above code) is quite literally the equivalent to $chr(1) for those people who use mIRC.
I personally used NetBeans to compile this.
Notes:
-I've been getting this error message, only recently (after some few days of testing)
| Code: |
| Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space |
I am working on fixing this.
Java Snippet:
MultiThreaded Socket Server
Posted on Nov 16, 2009 12:15 pm
Posted on Nov 16, 2009 12:15 pm
Does this open a port on your computer so someone from another can connect to your computer using it as a proxy?







