kishoret tata

Greenhorn
+ Follow
since Feb 15, 2004
Merit badge: grant badges
For More
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 kishoret tata

Hi,
does any one know why setSoTimeout() not working in blocking mode of SocketChannel?
Thanks.
Hi,
I am sorry. I misstyped by the time of posting ..
My code in class is :
//set 30 seconds time out
channel.socket().setSoTimeout(30000)
This not working ...
If I use channel.setSoTimeOut(30000) it doesn't compile first ...
If I set timeout -1 then I am getting exception where as if I set 30 seconds it is not working ..it is taking more than 2 minutes. It is not coming out after 30 seconds ...
Any ideas please ...
Thanks.
Hi,
I am not clear what you are saying. I searched lot on the net about this. I didn't see any method to set time out by the time of connecting to server. I would like to know is there any way to set timeout by the time establishing socket connection (insted of calculating startime and elapsed time etc ...).
One more thing is setSoTimeout() is not working if i set by the time of reading data from socket channel . Any ideas why it is not working.
Thanks.
Hi,

If I set timeout by the time of reading data from socket channel, but it is not working ...
I set 30 seconds but it is not coming out after after 30 seconds ... it is taking more than 2 minutes ..
Why is timeout not working .....
Here is my code ...
SocketChannel channel = null;
ByteBuffer requestByteBuffer = null;
ByteBuffer buffer = null;
ByteBuffer responseByteBuffer = ByteBuffer.allocate(100);
InetSocketAddress isa = new InetSocketAddress("xx.xxx.xxx.xxx",yyyyy);
try {
channel = SocketChannel.open(isa);
connected = channel.isConnected();
}catch (java.io.IOException ioe) { }
try {
requestByteBuffer = ByteBuffer.wrap(request, 0, request.length);
channel.write(requestByteBuffer);

// set timeout
channel.setSoTimeout(30000);
responseByteBuffer.rewind();
// Read bytes from the channel
numRead = channel.read(responseByteBuffer);
}catch(Exception e) { System.out.println("unable to read data from channel"); }
finally{
if (channel != null) {
try {
channel.close(); // close the channel
} catch (Exception e) {throw new RuntimeException(e);}
}
}
Thanks.
Hi,
I am using starttime, endtime calcualtion to throw an exception if the server is down.
Can any one help me how to use setSoTimeout() method insted of calculating
startime, elasped time etc ...
I want to thow an exception if the connection is not established in 10 minutes. ..
Here is my code ...
int timeout = 10 *1000;
long startTime = System.currentTimeMillis();
long elapsedTime = 0;
boolean connected = false;

InetSocketAddress isa = new InetSocketAddress("xx.xx.xx.xxx",yyy);
do {
try {
elapsedTime = System.currentTimeMillis() - startTime;
channel = SocketChannel.open(isa);
connected = channel.isConnected();
}catch (java.io.IOException ioe) {
if (elapsedTime > timeout)
throw new CommException("socket connection timeout.");
}
} while (elapsedTime < timeout && !connected);
Thanks.
Yes, That's true.
date1=1999046
Here 1999 is the year and 046 is Number of days since beginning of the year.
Thanks for your help ...
20 years ago
I have dates like
date1=1999046
date2=1987035 etc...
Now I need to convert these days into Gregorian Calendar date format like 'MM/DD/YYYY' .
Please can any one help me.
Thanks.
20 years ago
Hi,
I have dates like
date1=1999046
date2=1987035 etc...
Now I need to convert these days into Calendar date format like 'MM/DD/YYYY' .
Please can any one help me.
Thanks.
20 years ago
Hi,
I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
Can any one help me how to convert julian date to calendar Date.
Thanks,
Krishore.
20 years ago
Hi,
I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
Can any one help me how to convert julian date to calendar Date.
Thanks,
Krishore.
20 years ago
JSP
Hi,
I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
Can any one help me how to convert julian date to calendar Date.
Thanks,
Krishore.
20 years ago