Set timeout on socket?
If i want to set timeout on a clientsocket how do i do?
I know you use setsotimeout, but i don't know how
Can someone post a short samplecode?
Thanks!
(something like this but with timeout)
Socket MyClient;
try {
MyClient = new Socket("Machine name", PortNumber);
catch (IOException e) {
System.out.println(e);
}
Can you stop saying TRIPPLE POSTING BLA BLA BLA and
help me instead?
Stop multiposting and cross posting you fool.
I have said like 100 times i DON'T get it, it would
be nice if you posted some sample code so i can see
what i have been doing wrong.
Post your code and we can see where you have gone wrong. Please use your original thread for this.
Similar Messages
-
Setting timeout in Oracle Web Service Callouts
We have a 10.1.0.4 Enterprise DB with dbwsclient.jar loaded. Currently using the database callouts. The problem is there seems to be no timeout when the called web service does not respond. I did not see a setting for the socket timeout in the code produced by JPublisher.
ThanksHi,
Where the properties need to be put and how can they be read really depends on how your Web Service is implemented. What is the WS based on - EJB, POJO, PL/SQL, JMS...?
Yogesh -
Setting timeout for all the web test scripts in the solution
Hello,
I have around 16 web test scripts (using VSTS 2010 ultimate version) in my project (in a solution). By default the timeout set for each request is 60 sec. I need to increase the timeout to 180 sec. Currently, I am clicking on each request and modifying
the timeout parameter from the Properties window.
Is there any common setting for timeout available which would be acting across all the scripts?
Thanks.Hello,
We only can set Timeouts for a separate request in Visual Studio Web Test. There is no way to set Timeout for all requests in VS IDE. But you can write you own logic code using
Timeout Property in a web test plugin to set Timeout for all requests in a web test.
About how to write a web test plugin, please see:
How to: Create a Web Performance Test Plug-In
Best regards,
Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later. -
Setting timeout for webservice
hello all,
I have made client program to connect to a webservice using dynamic url, my problem is i am unable to set the timeout of the webservice if anybody knows please let me know. my code is as follows.
WebServiceClient ann = testpackage.TestClassService.class.getAnnotation(WebServiceClient.class);
try {
testpackage.TestClassService service = new testpackage.TestClassService(new URL("MY URL"), new QName(ann.targetNamespace(), ann.name()));
testpackage.TestClass port = service.getTestClassPort();
String result = port.getUserTask("HELLO");
System.out.println(result);
} catch (MalformedURLException ex) {
using this code how can i set timeout at client side
thanks in advancehi there thanks for your reply but your solution didn't worked for me. may be because of mistake in my question explanation i will explain it again
WebServiceClient ann = testpackage.TestClassService.class.getAnnotation(WebServiceClient.class);
try {
testpackage.TestClassService service = new testpackage.TestClassService(new URL("MY URL"), new QName(ann.targetNamespace(), ann.name()));
testpackage.TestClass port = service.getTestClassPort();
String result = port.getUserTask("HELLO");
System.out.println(result);
} catch (MalformedURLException ex) {
using this code i am calling my webservice and the function "getUserTask" which give me some output in return.
now, what situation i am facing is whenever i make a call to the above function and if RTO occurs after the call of the function then my application comes in to a hang mode situation. and i am unable to do anything untill the reconnection of the network occurs.Either i have to wait for the reconnection or i have to terminate my applicartion.
My desire is, i should be able to set my timeout period of a web service request. if no reply comes in the given time period then i should be able to raise any message to the user.
I think ihave made myself a bit more clear.
thanks for your reply once again. -
Setting timeout for SOAP requests in a webservice client
I am trying to set the timeout for a synchronous SOAP request sent to a Web Service deployed on weblogic 8.1 SP2. I tried setting timeout thru bindinginfo setTimeout() and also javax.xml.rpc.Stub _setProperty(). Both of them seem to be not working. I set the value to as low as 1 sec but i still donot get a timeout. Other properties/method from these two classes work fine though (like endpointaddress property in javax.xml.rpc.Stub and setVerbose flag to true in BindingInfo).
Can someone please help.
Thanks in Advance
sriniOur application calls the webservice provided by another company over the internet using the ssl. We use the wsdl url of the webservice on the destination while creating the port. If the destination is not available statement which creates the port blocks for around 4 minutes.
I think the first network call gets the wsdl from the remote server. Thus we encounter delays before getting the stub created. How can I timeout such a calls.
try {
port = (new ServiceName_Impl(remoteWsdlURL)).getServiceNameSoap();
} catch (IOException e) { -
How to get remaining time for baton after setting timeOut property
Hello,
Is it possible to get the remaining time for baton after setting timeOut, or do I have to maintain a separate Timer for that?
Been following this excellent tutorial here http://tv.adobe.com/watch/adc-presents/create-shared-forms-in-livecycle-collaboration-serv ice/Thanks Nigel, before reading your reply, I came up with something like this, but it seems extending the Baton class is not enough, as I would need my own BatonProperty as well that uses this extended Baton class...
Also attempted to get some help here http://stackoverflow.com/questions/7116814/actionscript3-lccs-how-to-access-property-paren t-class-protected-var/7116882#7116882
Could this be made into a feature request for Baton and BatonProperty, se we could easily get the remaining time please? I guess I can wait for a future release.
/custom as file /
package com.mysite.BatonExtender
import com.adobe.rtc.sharedModel.Baton;
import flash.events.TimerEvent;
public class BatonExtender extends Baton
public function BatonExtender()
super();
_autoPutDownTimer.addEventListener(TimerEvent.TIMER,countDown);
trace("CURRENT TIMER:"+_autoPutDownTimer.currentCount);
trace("BATONEXTENDER added");
public function countDown(p_evt:TimerEvent):void {
trace("TRACING START countDown....");
if (_autoPutDownTimer.running) {
trace(_autoPutDownTimer.currentCount);
//sharedTimer.value = String(90 - _autoPutDownTimer.currentCount);
trace("TRACING END...."); -
Hi, is possible to set timeout in a JSP?? For instance, when the user clicks on the a hyperlink it will open a page and after a time interval, the page will auto close and call the same JSP function to open the same page but with different values in it...
Hmm.. do u think it will work whereby the user will just need to click on a hyperlink once, then it will pass different value to a Javascript function each time. Coz the hyperlink that the user clicks will get the values from a text file (all the values retrieved are stored in a Vector.) which is passed to the Javascript function for loading an applet. As the applet will load some data out, hence, i need to wait till the applet finish loading, then i can call the same Javascript function again, but a different value...
-
nice day,
1/ how can I get real Html size in kB with intention to set as maxValue to ProgressMonitor
2/ how can I set/synchronize current valueOfDownLoadedHtml in kB to ProgressMonitor throught downloading Html content
3/ how can I set TimeOut for this Tast, (maybe ... could I use Timer)
import java.awt.BorderLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ProgressMonitor;
import javax.swing.SwingWorker;
public class ProgressMonitorDemo extends JPanel implements ActionListener, PropertyChangeListener {
private static final long serialVersionUID = 1L;
private ProgressMonitor progressMonitor;
private JButton startButton;
private JTextArea taskOutput;
private Task task;
private int sizeIn_kB = 0;
class Task extends SwingWorker<Void, Void> {
private String str;
int progress = 0;
public Task(String str) {
this.str = str;
@Override
public Void doInBackground() {
if (str.equals("Loads")) {
addBackgroundLoadsData();
setProgress(0);
while (progress < sizeIn_kB && !isCancelled()) {
progress += sizeIn_kB;
setProgress(Math.min(progress, sizeIn_kB));
return null;
@Override
public void done() {
if (str.equals("Loads")) {
Toolkit.getDefaultToolkit().beep();
startButton.setEnabled(true);
progressMonitor.setProgress(0);
public void addBackgroundLoadsData() {
InputStream in = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
String charset ="";
try {
String UrlString = "http://java.sun.com/";
URL url = new URL(UrlString);
URLConnection conn = url.openConnection();
sizeIn_kB = conn.getContentLength();
charset = conn.getContentEncoding();
conn.setRequestProperty("Accept-Charset", charset);
in = conn.getInputStream();
int len;
byte[] buf = new byte[1024];
while ((len = in.read(buf)) > 0) {
bos.write(buf, 0, len);
in.close();
String charEncoding = Charset.defaultCharset().name();
//String fileEncoding = System.getProperty("file.encoding");
//System.out.println("File Encoding: " + fileEncoding);
//System.out.println("Char Encoding: " + charEncoding);
//System.out.println("Char Encoding: " + Charset.availableCharsets());
charEncoding = "cp1250";
String groupImport = new String(bos.toByteArray(), charEncoding);
conn = null;
} catch (IOException ioException) {
ioException.printStackTrace();
JOptionPane.showMessageDialog(null, ioException.getMessage(), "Htlm error", JOptionPane.ERROR_MESSAGE);
} catch (StringIndexOutOfBoundsException ioException) {
ioException.printStackTrace();
JOptionPane.showMessageDialog(null, ioException.getMessage(), "InputStream error", JOptionPane.ERROR_MESSAGE);
public ProgressMonitorDemo() {
super(new BorderLayout());
startButton = new JButton("Start");
startButton.setActionCommand("start");
startButton.addActionListener(this);
taskOutput = new JTextArea(5, 20);
taskOutput.setMargin(new Insets(5, 5, 5, 5));
taskOutput.setEditable(false);
add(startButton, BorderLayout.PAGE_START);
add(new JScrollPane(taskOutput), BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
@Override
public void actionPerformed(ActionEvent evt) {
progressMonitor = new ProgressMonitor(ProgressMonitorDemo.this, "Running a Long Task", "", 0, 100);
progressMonitor.setProgress(0);
task = new Task("Loads");
task.addPropertyChangeListener(this);
task.execute();
startButton.setEnabled(false);
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("progress" == null ? evt.getPropertyName() == null : "progress".equals(evt.getPropertyName())) {
int progress = (Integer) evt.getNewValue();
progressMonitor.setProgress(progress);
String message = String.format("Completed %d%%.\n", progress);
progressMonitor.setNote(message);
taskOutput.append(message);
if (progressMonitor.isCanceled() || task.isDone()) {
Toolkit.getDefaultToolkit().beep();
if (progressMonitor.isCanceled()) {
task.cancel(true);
taskOutput.append("Task canceled.\n");
} else {
taskOutput.append("Task completed.\n");
startButton.setEnabled(true);
private static void createAndShowGUI() {
JFrame frame = new JFrame("ProgressMonitorDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent newContentPane = new ProgressMonitorDemo();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}See the session-descriptor element of weblogic.xml deployment descriptor:
http://download.oracle.com/docs/cd/E21764_01/web.1111/e13712/weblogic_xml.htm#i1071981 -
Set timeout for completion of each thread
i have a requirement where i need to start n threads and set timeout for completion of each thread.
if the thread is not executed successfully(because of timeout ) i have to enter in audit table that it failed because of timeout
if executed successfully update audit table with success.
can some one give me solution for this using ThreadPoolExecutor available jdk1.5Add a scheduled task to time out the task (when it would time out). Keep the Future and cancel it if the task completes successfully.
final Future future = executor.schedule(new TimeoutTask(), timeoutMS, TimeUnit.MILLI_SECONDS);
executor.execute(new Runnable() {
public void run() {
try {
task.run();
} finally {
future.cancel(true);
}); -
Set timeout for URL connection in java1.4
hi
I want to set timeout for URL connection in java 1.4..
java 5.0 provides with a setTimeout(int ) method but how should it be done in 1.4 environment
Thanks in advance
snehasun.net.client.defaultConnectTimeout (default: -1)
sun.net.client.defaultReadTimeout (default: -1)
See the [Networking Properties|http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html]. -
Need help about setting timeout webservice client.
Hi,
I trying to set timeout before make call to the webservices, my target webservice is deployed on WebLgic server 8.14 (service pack 4). Nothing just Thread.sleep for 1 min. then return some string. Here is my client code. I use the proxy generated by the workshop testing browser, "Java proxy" button.
public static void main(String a[]) {
try {
EjbTimeout_Impl proxy = new EjbTimeout_Impl();
EjbTimeoutSoap_Stub myStub = (EjbTimeoutSoap_Stub)proxy.getEjbTimeoutSoap();
BindingInfo bInfo = (BindingInfo)myStub._getProperty("weblogic.webservice.bindinginfo");
System.out.println(bInfo.getTimeout()); // print out '-1' no timeout I guess
bInfo.setTimeout(5); //secs
System.out.println(bInfo.getTimeout()); // print out '5', value change accepted
myStub._setProperty("weblogic.webservice.rpc.timeoutsecs", "5");
System.out.println(myStub._getProperty
("weblogic.webservice.rpc.timeoutsecs")); // also print '5'
String ss = myStub.sayHello("WEBLOGIC");
System.out.println(ss);
} catch (Exception e) {
System.out.println(e.toString());
As you see the timeout value is changed but when I call webservice from this client everything is fine. The output string ruturn from webservice is printed out after Thread.sleep(60000).
Are there any missing things about this client code, my webservice code is quite simple, or if there is some way else to achieve this ???
Many thanks.Before you use the JMS, you need to deploy some drivers related to specific MQseries, Kindly ensure that proper driver are deployed....
If you use MQSeries 53x.xxx, you must enter the following JAR files in aii_af_jmsproviderlib.sda.
com.ibm.mq.jar, com.ibm.mqbind.jar, com.ibm.mqjms.jar, connector.jar (use the JAR file from the J2EE client directory)
check this link it will give you more inofmration
http://help.sap.com/saphelp_nw04/helpdata/en/cd/d85a9d6fab7d4dbb7ae421f710626c/content.htm
check this to get the condifuration the JMS
How to use conversion modules in JMS - https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891
Ref How To Use the Content Conversion Module in JMS Adapter - https://websmp106.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000582377& -
message loop filling system log.
Text: discoveryd Basic Sockets Couldn't set IP_BOUND_IF on socket fd[72] scopeID[4] errno[22] result[-1]
Value of fd[] does cycle
Loop prevents access to internet
Tried work-around from http://apple.stackexchange.com/questions/153080/computer-name-keeps-changing-osx -10-10-14a389
Basely has an affect.
Power-off of router stops the loop.
Powered-off for 5 (five) minutes and can access internet
Macbook Air (MBA) and iMac both experience the loopPlease read this whole message before doing anything.
This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
Test while in safe mode. Same problem?
After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test. -
Set TIMEOUT on OCCI sql query using ?
Is there a way to set a timeout on a sql query using OCCI ?
OCCI does not provide an API to set timeouts on SQL Queries.
You can use the CREATE PROFILE command and assign resources at
a user level. The restrictions may be applied to memory/resources which
in turn would control the SQL execution time. Please check the
CREATE PROFILE command.
Rgds
Amogh -
How to set timeout during call oci api
hi all :
in my program i use OCIInitialize and OCIEnvInit to connect oracle 10g ,but sometime the db does not return ,whether ok or error , at the same time i use sqlplus to connect db ,it is the same .
so i want to set timeout in my program , does oracle support set timeout in the such scene , if support ,how can i do ?
thanks a lot
Message was edited by:
user549861print code :
if(OCIInitialize(OCI_THREADED ,0, 0, 0, 0)!=OCI_SUCCESS)
return -1;
if(OCIEnvInit( (OCIEnv **) &(p_env), OCI_DEFAULT, 0, 0 )!=OCI_SUCCESS)
return -1;
if (OCIHandleAlloc ((dvoid *)p_env, (dvoid **)&p_srv,
OCI_HTYPE_SERVER, 0, (dvoid **) 0)!=OCI_SUCCESS)
return -1;
if(OCIHandleAlloc(p_env, (dvoid **) & (p_err), OCI_HTYPE_ERROR, 0, 0)!=OCI_SUCCESS)
return -1;
if (OCIServerAttach (p_srv, p_err, (text *)strNodeName,
strlen (strNodeName), OCI_DEFAULT)!=OCI_SUCCESS)
return -1;
if(OCIHandleAlloc(p_env, (dvoid **) & (p_svc), OCI_HTYPE_SVCCTX, 0, 0)!=OCI_SUCCESS)
return -1;
if (OCIHandleAlloc ((dvoid *)p_env, (dvoid **)&p_ses,
OCI_HTYPE_SESSION, 0, (dvoid **) 0)!=OCI_SUCCESS)
return -1;
if (OCIAttrSet ((dvoid *)p_svc, OCI_HTYPE_SVCCTX,
(dvoid *)p_srv, (ub4) 0, OCI_ATTR_SERVER, p_err)!=OCI_SUCCESS)
return -1;
if (OCIAttrSet ((dvoid *)p_ses, OCI_HTYPE_SESSION,
(dvoid *)strUserName, (ub4)strlen(strUserName),
OCI_ATTR_USERNAME, p_err)!=OCI_SUCCESS)
return -1;
if (OCIAttrSet ((dvoid *)p_ses, OCI_HTYPE_SESSION,
(dvoid *)strPasswd, (ub4)strlen(strPasswd),
OCI_ATTR_PASSWORD, p_err)!=OCI_SUCCESS)
return -1;
if (OCISessionBegin (p_svc, p_err, p_ses,
OCI_CRED_RDBMS, OCI_DEFAULT)!=OCI_SUCCESS)
return -1;
if (OCIAttrSet ( (dvoid *)p_svc, OCI_HTYPE_SVCCTX,
(dvoid *)p_ses, (ub4) 0, OCI_ATTR_SESSION, p_err)!=OCI_SUCCESS)
return -1;
how can i set timeout in the these code -
CreateObject - webservice - setting Timeout
I'm trying to set the timeout of a webservice using the
createObject method.
I am running Coldfusion 8,0,1,195765.
The coldfusion documentation specifies that you can pass a
arguments struct to createObject that will set variation properties
of the webservice object including the timeout.
CreateObject:
web service object
As documented, I'm creating the webservice using the attached
code. Despite specifying specifying the timeout to be 15 seconds,
the object's timeout gets set to 0 (default, no timeout). I need to
specify the timeout because I do not want page to hang if the
webservice provider goes out.
Does coldfusion 8.0.1 actually support specifying the
timeout? If so, am I creating the Webservice object correctly?Hi,
In case of Adaptive Webservice model, we can set timeout using this code.
Request_NumberToWords requestMO = new Request_NumberToWords(model);
requestMO.wdSetInvocationModifier(
new IWDWSInvocationModifier() {
public void doModifyInvocation(Object port) {
HTTPControlInterface httpItf = HTTPControlFactory.getInterface(port);
//timeout for this WS invocation is 120 sec; don't use global config. setting of WS-Runtime
httpItf.setSocketTimeout(120000);
public void doModifyAfterInvocation() {}
Regards
LN
Maybe you are looking for
-
How do I increase the text size in photoshop 10
I can't read the program text it is so small and I can't find how to increase it. Thanks for your help.
-
RE: Force user to re-login if the application is idle for awhile!
Hi, I a similar thing a little while ago for an application written in a 4gl (not Forte) running windows 95 clients. I ended up dropping out to "C" and using the SDK to install hooks which monitored certain mouse and keyboard events to the applicatio
-
Why can't I get a straight answer re: Multi Room DVR and HD Boxes
A rep that I spoke w/ on the phone and the website tells me that the HD set top boxes are not compatiable w/ the Multi Room DVR. But they are working on it. A rep I chatted w/ today told me they definitely WILL work together. Why can't I get a straig
-
DateTime as OracleParameter? How ?
float [] m_upVal = new float [3]; DateTime [] m_upT = new DateTime[3]; OracleCommand upcom = new OracleCommand (upcstr,upcon); upcom.CommandText = "update current_values set value = :val, time_stamp = to_date(:t_st, 'dd:mm:yyyy hh24:mi
-
I get a pop up window that says Personalize your software and when I put in the serial number it says it is invalid. I haven't changed computers or done anything. I used the program on Wed and then on Friday I went to use it again and that is when it