ich habe 2 programme aus dem Buch java ist auch eine insel
und
jedoch wenn ich die programme starte bekomme ich eine fehlermeldung von eclipse. (ich habe mich natürlich auf dyndns angemeldet und meine ip angegeben)
helft mir pls wenn ihr weiterwisst
Code:
import java.io.*;
import java.net.*;
public class Server
{
private static void handleConnection( Socket client ) throws IOException
{
InputStream in = client.getInputStream();
OutputStream out = client.getOutputStream();
int factor1 = in.read();
int factor2 = in.read();
out.write( factor1 * factor2 );
}
public static void main( String[] args ) throws IOException
{
ServerSocket server = new ServerSocket( 3141 );
while ( true )
{
Socket client = null;
try
{
client = server.accept();
handleConnection ( client );
}
catch ( IOException e ) {
e.printStackTrace();
}
finally {
if ( client != null )
try { client.close(); } catch ( IOException e ) { }
}
}
}
}
und
Code:
import java.net.*;
import java.io.*;
class Client
{
public static void main( String[] args )
{
Socket server = null;
try
{
server = new Socket( "bsp.dyndns.com", 3141 );
InputStream in = server.getInputStream();
OutputStream out = server.getOutputStream();
out.write( 9 );
out.write( 6 );
int result = in.read();
System.out.println( result );
}
catch ( UnknownHostException e ) {
e.printStackTrace();
}
catch ( IOException e ) {
e.printStackTrace();
}
finally
{
if ( server != null )
try { server.close(); } catch ( IOException e ) { }
}
}
}
jedoch wenn ich die programme starte bekomme ich eine fehlermeldung von eclipse. (ich habe mich natürlich auf dyndns angemeldet und meine ip angegeben)
helft mir pls wenn ihr weiterwisst