my socket program under windows work but under linux don't ,plz help me?

Hi guys,,

when I run java program using socket under windows ok no problem but the same program under linux don't work. why?

Are there any configuration I must do under linux for work program?

Are there change on code?

please Help me...

My step for run program under linux:

for celint

1. compiler the code

javac MulticastGetTime.java

2. run the program

java MulticastGetTime

another pormet

for server

1. compiler the code

javac MulticastTimeServer.java

2. run the program

java MulticastTimeServer

my code

server code :

import java.io.IOException;

import java.net.DatagramSocket;

import java.net.InetAddress;

import java.net.DatagramPacket;

import java.util.Date;

public class MulticastTimeServer {

public static void main(String args[]) throws

IOException {

DatagramSocket socket =

new DatagramSocket(1213);

while (true) {

byte buffer[] = new byte[256];

String date = new Date().toString();

buffer = date.getBytes();

InetAddress address =

InetAddress.getByName("230.0.0.1");

DatagramPacket packet

= new DatagramPacket(buffer,

buffer.length,

address, 9013);

socket.send(packet);

// sleep so as not to flood the network

try{

Thread.sleep(1000);

} catch (InterruptedException e){

e.printStackTrace();

}

}

}

}

code for client :

import java.io.IOException;

import java.net.InetAddress;

import java.net.DatagramPacket;

import java.net.MulticastSocket;

public class MulticastGetTime {

public static void main(String args[]) throws IOException

{

MulticastSocket socket = new MulticastSocket(9013);

InetAddress address = InetAddress.getByName("230.0.0.1");

socket.joinGroup(address);

DatagramPacket packet;

byte message[] = new byte[256];

packet = new DatagramPacket(message, message.length);

socket.receive(packet);

String time = new String(packet.getData());

System.out.println("The time is: " + time);

socket.leaveGroup(address);

socket.close();

}

}

this run under windows and work are good

pleae help me

[2335 byte] By [khalidjabera] at [2007-10-3 5:08:21]
# 1
cross post!
hiwaa at 2007-7-14 23:14:28 > top of Java-index,Core,Core APIs...