This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!

Natesan Prabhakaran

Ranch Hand
+ Follow
since Jul 11, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Natesan Prabhakaran

Hi Everyone,

I am new to Weblogic. I installed weblogic10g in my machine. After that, I created one domain called citi_domain. Then I started the server from the below location

C:\bea\user_projects\domains\citi_domain\bin - startWebLogic

Then, I try to access the console page., Its showing the below error. I could not find any correct solution for this error.

Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

Can any one please help on this. Thanks.

-Prabhakaran.N
11 years ago

My thought was to create a port for Client A and a different port for Client B on the server and then somehow pass the message through.




Server always listen on the same port. Client will connect to the server with different Ip address in the same port number.

-Prabhakaran
Hi karl, the below program will help you much.

Server:
public class TCPServer{
private ServerSocket server;
private int port = 7777;

public TCPServer() {
try {
server = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
TCPServer example = new TCPServer();
example.handleConnection();
}

public void handleConnection() {
System.out.println("Waiting for client message...");

while (true) {
try {
Socket socket = server.accept();
ConnectionHandler cd = new ConnectionHandler(socket);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}


for each client separate Thread will be created

Thread Class: ConnectionHandler

class ConnectionHandler implements Runnable {
private Socket theclient;
ServerSocket serverSocket = null;

public ConnectionHandler(Socket theclient) {
this.theclient = theclient;

Thread t = new Thread(this);
t.start();
}

public void run() {
try
{
PrintWriter out = new PrintWriter(theclient.getOutputStream(),true);
BufferedReader in = new BufferedReader(new InputStreamReader(theclient.getInputStream()));
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

String inputLine, outputLine;
while((inputLine=in.readLine()) != null) {
out.println();

System.out.println("From Client:"+inputLine);
outputLine=input.readLine();
out.println(outputLine);

if (inputLine.equals("Bye"))
break;
}
out.flush();

out.close();
in.close();
theclient.close();
serverSocket.close();

} catch (IOException e) {
e.printStackTrace();
}
}
}


Client:

public class TCPClient {
public static Socket clientSocket = null;
public static PrintWriter out = null;
public static BufferedReader in = null;
public static int port=0;
static InetAddress mcAddress=null;

public static void main(String[] args) {
try
{
mcAddress = InetAddress.getByName("228.1.2.3");
port = Integer.parseInt("7777");
clientSocket = new Socket("localhost", port);
out = new PrintWriter(clientSocket.getOutputStream(), true);

in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

String userInput;
String inetAddress = clientSocket.getInetAddress().getHostName();
out.println(inetAddress);
while((userInput = input.readLine())!= null)
{
out.println(userInput);
System.out.println("From Server: "+ in.readLine());
out.flush();
}

out.close();
in.close();
input.close();
clientSocket.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}


-Prabhakaran
Thanks Matt. Its little bit working. I am tuning it further based on my application.

Thanks again.
-Prabhakaran
Hi All,

Now I am creating single application using TCP and UDP Sockets. I have doubt on this, Actually, I am sending a file using UDP Multicasting. If three clients are receiving that file. I need to find receive missing packets by using TCP from all clients. I can do this. But how can I break this loop

while(true)
{
theclient = serverSocket.accept();
receiveMissingPackArray = new ReceiveMissingPackArray(clientNo,theclient,no_of_packets);
}

once all the missing packets are received. I have some question.
1) How to find number of clients connected to server.
2) How to find stil clients are connectd to server or not.

If any one help on this, which will be very useful for me.
Thanks in Advance.
-Prabhakaran
Hi All,

I am having a small doubt in Threads. In my application, I am creating a ArryList in ClassA, adding 100 different values. Now I am passing this ArrayList to ClassB. Here, creating 'n' number of threads. All the threads are making some chages on the same ArrayList. If one thread made any changes, It should reflect to another.

Can any one Help me for this condition. Thanks.

Regards,
Prabhakaran

Thanks for your valuable response.

Here is my code, I don't know, how to do using pseudo code.

Socket theclient = null;
ServerSocket serverSocket=null;
f = new File("E:/Examples/EVR.pdf");
filelength = f.length();

serverSocket = new ServerSocket(8888);
theclient = serverSocket.accept();
System.out.println("coming SendTotalPackets");
pout = new PrintWriter(theclient.getOutputStream(),true);
pout.println(filelength);
pout.flush();

Hi All,

I am new to Socket programming. So, I don't know that is there a way to send a message from one server to multiple clients using TCP. When I search for it, came to know, it is possible only by using DatagramSocket (UDP). Is it not possible by using TCP? Please correct me.

Thanks.
Hi All,

I am using UDP for file send and receive. I know that, it is not reliable. But my boss advise to use UDP only. So, while receiving the packets (due to fast sending and slow receiving) some of the packets are missing. I already slow down the sending part. still some of the packets are missing. So, Can any one give me that code sample for, how to trace missing UDP packets and how to resend it back.

Thanks.

Regards,
Prabhakaran

11 years ago
Thanks a lot paul.

That’s the reason why, if any packets missed out, I request for missing packets. Then, by using RandomAccessFile, need to send back the missing data only. Also, I want to write it into PDF file in the receiving end.

So, Please tell me, is there any possibility to write on PDF by using RandaomAccessFile, else suggest me an idea.

- Prabhakaran
11 years ago
But compare to UDP, TCP will take much time to transfer a very large file and huge amount of files at a time. Thats the reason, I go with UDP.
11 years ago
Thanks for your reply.

I am sending PDF (other formats also)file using UDP. If while missing some packets, I need to send back missing packets and write it into PDF file. But PDF format is somehow distrubing to do that.

Also, can you suggest better third-party API for it.

-Prabhakaran
11 years ago
Hi All,

I am new to this API. I have a doubt from RandomAccessFile. Can anyone tell me that, how to read and write PDF files using RandomAccessFile class. Otherwise I need to use any third party APIs.

Thanks in advance.

Regards,
Prabhakaran
11 years ago
If I try to access directly, Its showing Error like Undicleared Variable.
"s can not be resolved"
12 years ago
JSP