How to control socket timeout

I have an application that connects to a ftp server. After some time that the user doesn�t do anything, I get a timeout message. I set socket.setSoTimeout(0) but I still get the message. I keep the connection to the ftp server open all the time.
It should be better to open and close every time ? the user needs to access a lot of times to the ftp server, but maybe he can stay some time without having to access it (here is when I got the message "No Transfer Timeout (300 seconds): closing control connection").
How can I control, before sending a command to the ftp server, if it happens this to do another connection ?
Thanks !

hehe, i've had the same problem many times, let the ftp client alone for a while, and then you got to write your name and password again...
i guess the server wont let you change its properties. don't know the tcp commands that could get it.
and about doing something every minute, well, it works for you, but the timeout has ist causes, and it is not nice to use the server and the net resources fon nothing.
my advice, just make the user interface of your client nice, and if if gets disconnected because timeout, just wait till the user wanna do somethingm and then connect again without asking for his/her password and login, nor ftp address...
so the user wont be annoyed, nor the server.

Similar Messages

  • How to control the timeout for StreamSocket.ConnectAsync(), and StreamSocketListener.AcceptAsync()?

        I can not file API to do this.Ray_ni

    Hi Ray,
    Here is a simple sample...
    async void btnGetData_Click(object sender, RoutedEventArgs e)
    // separated all this out so it is clearer:
    //Create a socket
    StreamSocket aSocket = new StreamSocket();
    //Cancellation token is inspected to determine if the async method should be cancelled
    CancellationTokenSource cts = new CancellationTokenSource();
    //In this case, after 2 seconds... signal cancel
    cts.CancelAfter(2000);
    //get the operation
    StreamSocketConnectOperation op = aSocket.ConnectAsync(new Windows.Networking.HostName("localhost"), "22112", SocketProtectionLevel.PlainSocket);
    //Create a task and pass the cancellation token
    Task aTask = op.StartAsTask(cts.Token);
    try
    //kick off the task and wait for a result!
    await aTask;
    catch(TaskCanceledException tcEx)
    string a = "Task Cancelled: " + tcEx.Message;
    catch(Exception theEx)
    string b = "Exception: " + theEx.Message;
    finally
    string c = "done, still might have had an exception though";
    Enjoy!
    -Jeff
    Jeff Sanders (MSFT)

  • Inability to control initial timeout in Socket Factory

    Hello,
    We have built our own RMI socket factory where we want to control the timeout of the sockets created there. This is our code
        public Socket createSocket(String host, int port) throws IOException {
                Socket socket = new Socket(host, port);
                socket.setSoTimeout(requestTimeout);
                return socket;
        }Due to spurious heavy loads on our server, we need to operate with timeout values up to 100 seconds.
    However, we find that it is impossible to control the initial socket creation timeout. We observe this thought the lack of giving the the desired timeout parameter. Thus, the socket times out in the default 10 seconds in this initial call, not waiting the desired 100s before making the exception.
    Creating the socket through first creating a default socket and afterwards binding it like this
    Socket socket = new Socket();
    socket.setSoTimeout(socketTimout);
    socket.bind(new InetAddress(host,port));did not seem to do the trick in this setting either (neither did replacing bind with connect).
    What is the reason for this shortcoming in the API? Any workarounds?
    Best regards,
    Helge Fredriksen

    You want:
    Socket socket = new Socket();
    socket.connect(host,port,connectTimeout);
    socket.setSoTimeout(readTimeout);
    return socket;Socket.setSoTimeout only sets the read timeout. Also be aware that with the timed connect shown above you can usually only reduce the timeout, not increase it, from its default.

  • Socket timeouts while downloading huge amount of mails..................

    Problem Statement:
    I have created a utility(using JavaMail API) which downloads mails from the Exchange Server 2003(MS Windows server 2003) using IMAP service.
    The utility uses 5 different threads(each creating it's own separate IMAP session) to download the mails from the same user mailbox account. A separate main controlling thread has been used, which feeds these 5 threads with the start-end message counts with a batching of 100 messages. The 5 threads also set the message delete flag after downloading/processing the messages. And finally the main controlling thread expunges the mail box account after a certain amount of time(1 hour). (The service also takes care of expunging the messages at the startup as well.)
    The utility runs fine for a long time(say 8 to 10 hours) but then it suddenly starts giving socket timeout exceptions and then it continues giving the exceptions. I even introduced a delay of 15 min. and increased the socket timeout period but to no avail. All i had to do was to restart the exchange server and after some time, i again started the utility and it worked finely.
    Exception stack trace:
    * BYE JavaMail Exception: java.net.SocketTimeoutException: Read timed out
    javax.mail.MessagingException: * BYE JavaMail Exception: java.net.SocketTimeoutException: Read timed out;
    nested exception is:
    com.sun.mail.iap.ConnectionException: * BYE JavaMail Exception: java.net.SocketTimeoutException: Read timed out
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:477)
    at javax.mail.Service.connect(Service.java:275)
    at com.newgen.omni.mail.mswrapper.MailServerWrapper.connect(MailServerWrapper.java:102)
    at com.newgen.omni.mail.mswrapper.MailServerWrapper.<init>(MailServerWrapper.java:33)
    at com.newgen.omni.mail.scheduler.Scheduler.Process(Scheduler.java:352)
    at com.newgen.omni.mail.scheduler.Scheduler.run(Scheduler.java:293)
    at com.newgen.omni.mail.scheduler.Scheduler.execute(Scheduler.java:1026)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
    Caused by: com.sun.mail.iap.ConnectionException: * BYE JavaMail Exception: java.net.SocketTimeoutException: Read timed out
    at com.sun.mail.iap.Protocol.handleResult(Protocol.java:299)
    at com.sun.mail.iap.Protocol.simpleCommand(Protocol.java:316)
    at com.sun.mail.imap.protocol.IMAPProtocol.login(IMAPProtocol.java:290)
    at com.sun.mail.imap.IMAPStore.login(IMAPStore.java:517)
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:458)
    ... 8 more
    The code snippet to make the IMAP connection (all the 6 threads call it separately to create separate sessions):
    Properties prop = new Properties();
    logger.debugMsg("mailCapture :: Process :: Initializing IMAP context...");
    prop.put("mail.imap.appendbuffersize","-1");
    prop.put("mail.imap.allowreadonlyselect","true");
    prop.put("mail.imap.separatestoreconnection","true");
    prop.put("mail.imap.partialfetch","false");
    prop.put("mail.imap.connectiontimeout", "1200000");
    prop.put("mail.imap.timeout", "1200000");
    session = Session.getInstance(prop);
    //session.setDebug(true);
    logger.debugMsg("mailCapture :: Process :: Get Store...");
    store = session.getStore("imap");
    try
    store.connect(mailServerInfo.strServerIP, Integer.parseInt(mailServerInfo.strServerPort), mailServerInfo.strUsername, mailServerInfo.strPassword);
    catch(MessagingException ex)
    logger.logException(ex.getMessage(), ex);
    Thread.sleep(900000);
    throw ex;
    I have tried with session debugging as well when the exceptions started coming(restart the service with session debugging true) but it doesnt give me any information worthwhile, either the utility stucks on the store.connect or otherwise if it connects then it stucks while opening the folder while using (sourceMailAccountFolder.open(Folder.READ_WRITE);) and doesn't move any further.
    NOTE: While the IMAP service is throwing socket time out exceptions, at the same time I am able to access my account using the http://<ip>/exchange/administrator and the server machine cpu and memory usages are very low as well. I am also having a separte utility which uploads mails using smtp and it is also working fine and uploading the mails whilest the imap utility is throwing the socket timeout exceptions.......
    Please help on this as i am not able to resolve it myself.....................

    Can simultaneously uploading the mails through smtp affect the imap performance(and hence the javamail).
    Note: The mailbox size is over 200000 mails when it started giving exceptions.
    When the socket timeout exceptions came(i have experienced them for the last three days), i was still able to send mails using smtp and the telnet also working fine and even without any delays, infact as i said, the utility sometimes connects but then fails, while using sourceMailAccountFolder.open(Folder.READ_WRITE); giving socket timeout errors and then dnt go any further.
    Right now i have stopped the smtp uploading the mails(for the first time) but still the javamail takes a long time(variable) to connect to the server and the mail body and attachment accessing speed is also a little slow, will see and post back, if the socket timeout exceptions come again.
    Note: My aim is to download more than some 250000 mails within a day through javamail, whilest i am simultaneously uploading them using SMTP.
    My other survice, using SMTP pumps in messages within a loop.

  • How to set a timeout for a ws call??

    Hi all. I tried looking inside the forum though I couldn't find anything about this, please, if I'm wrong let me know.
    The issue is the following, the company has a mainframe that exposes through CICS-SOAP a webservice which is known to be running properly (lets call it WS1). I am developing a second webservice (lets call it WS2) in a WebSphere App Server v6.0 that consumes WS1, does something after getting a result and then sends back to an external client the result as a response to the WS2 request.
    Visually, its something like this:
    [WS1 - mainframe] <--> [WS2 - WAS] <--> [Client]
    WS2 was developed using Rational Software Architect v7.0 by using a Dynamic Web Project, and using the Web Service Client Wizard which creates a client from a remote WSDL, and on the other hand creates a Java class to implement the Web Service.
    My only problem now is the fact that I need to control a timeout between WS1 and WS2. I tried using threads but with no good result. Now I absolutely have no idea how to do it. Basically I use the generated proxy to call the WS1 Method from WS2 and that's it, however I need to control that this process doesn't take longer than XX milliseconds.
    Could somebody be of any help? That would really be appreciated.

    Why not having this control in your server ?.
    It should be similar like how a yahoo page is timed out
    Regards,
    Mukunt

  • TimesTen environment variables that control TAF timeouts

    Hi
    I am some questions.
    I read the following contents in the TimesTen 7.0 manual .
    There are two TimesTen environment variables that control TAF timeouts:
    o TT_ORA_FAILOVER_TIMEOUT: TAF timeout in minutes for the user application
    (SWT cache groups, cache groups with the propagate option, and cache
    groups using the passthrough feature). The default is 5 minutes.
    o TT_ORA_FAILOVER_TIMEOUT: TAF timeout in minutes for the
    replication agent (for AWT cache groups). The default is 5 hours.
    How do I set one of these variables TT_ORA_FAILOVER_TIMEOUT , TT_ORA_FAILOVER_TIMEOUT ?
    Thank you very much.

    Hopefully you are now on a 11.2.n release or planning to be.  These settings are now part of the ttCaacheConfig callable procedure.
    Sorry I've not seen hwo they would be set in 7.0.
    Steve

  • Weblogic invoking web service failed due to socket timeout

    Hi,
    I encountered an error when I invoke web service from OBIEE 11g. The web serivce resides on Websphere running on other machine.
    An error says that "Invoking web service failed due to socket timeout." and it seems that it stopped in just 40 secs.
    Is there any settings of WebLogic server to avoid this? This web service normally runs for more than 60 sec.
    I have checked several parameters by WebLogic admin console and changed those values, but I still receive same errors.
    Regards,
    Fujio Sonehara

    Hey Eason,
    As I had previously mentioned, I have checked the FE server certs and have mentioned the signing algorithm it used to sign the certs, which was sha1DSA and not sha1RSA, I even checked my CA list of issued certs and have found all certs are signed the same.
    Signature algorithm: sha1DSA
    Signature Hash Algorithm: sha1
    Public Key:  RSA (1024 bit)
    I could run request and reinstall all day long it will still get the same certs signed with the algo..
    Doing some research I attempted to see if I could change the signing cert for a specific cert template that was being used to issue the Lync FE certs... however seems that from according to
    this, that I'd have to completely rebuild my CA before I'd be able to request and issue a cert with the proper signing algorithm?!
    This
    says its possible but not supported, what do I do in this situation? Is my only option to rebuild teh entire CA and cert infrastructure?
    I noticed my CSP is set to Microsoft Base DSS Cryptographic Provider, and under the CSP folder there is no "CNGHashAlgorithm" key so I'm using a "Next Gen CSP" apparently? Is this CSP good enough to support Lync...Straight up where is
    the Lync documentation on the CA setup requirements??
    This google link doesn't tell you how you should setup a CA for Lync, what settings need to set etc..

  • WebService Socket Timeout Exception before reaching timeout duration

    Hi
    My Server is Websphere Application Server 6.0.2.17
    i got some times socket timeout exception before reach timeout duration. and also i have only default websphere settings for web service .
    The exception is occurred in 19 seconds after hitting the service . i am not able to get the exact problem . because default timeout time is 300 seconds (i think like that)
    Error Log
    2/12/09 11:01:28:323 CET 00000f6a SystemOut O WebService Started --> Begin webservice method invocation (Method Name : getCustomerInfo(String cusID))
    2/12/09 11:01:47:840 CET 00000f6d SystemOut Exception Occurred : java.net.SocketTimeoutException: Socket operation timed out before it could be completed
    WebService Method Invocation Started time 11:01:28
    WebService Timeout exception raised time 11:01:47
    TimeoutDuration 00:00:19

    Hi Mark,
    with synchronous messages it is important to consider timeouts from each connection to be established. So soapUI-PI, then PI-BackendSystem plus anything that might be in between. If your timeout soapUI-PI is smaller than the following ones, you'll get that phenomenon. soapUI will cut the connection, but PI will hold it and maybe receive an answer from the backend. This answer will end up in the void, since the original requester (your soapUI) has already disconnected. But for PI, this will be OK and status "successful". PI does not control and monitor the client's connection.
    In other words, the cancel of the connection is only performed for that same connection, it is not propagated to any subsequent connections.
    Hope that I was clear enough,
    Jörg

  • Socket timeout on Mac

    Hello,
    I am trying to run the flexunit ANT task on a Mac but keep getting the following error.
    [flexunit] Stopping server ...
    [flexunit] End of test data reached, sending acknowledgement to player ...
    [flexunit] Closing client connection ...
    [flexunit] Closing server on port [1024] ...
    "Socket timeout waiting for flexunit report"
    I see the test runner launch in Flash Player but then nothing else happens after that.  I'm assuming FlexUnit isn't able to communicate with flash player but at this point i am not sure how to remedy the problem.
    Does anyone have any suggestions on how to get flexunit and ANT working on a Mac?
    Thanks.

    Thanks for the help so far.  I am using the RC1 SWCs.  I've also tried different ports but that didn't help either.  The flexUnit.cfg file is getting created.
    This is what my flexunit task looks like (defined in a macro)...
                <flexunit swf="@{bin.dir}/@{mxml.name}.swf" toDir="@{report.dir}"
                    player="flash"
                    headless="true"
                    haltonfailure="false"
                    verbose="true"
                    localTrusted="true" />
    And here is my build output...
    [flexunit] Using the following settings:
    [flexunit]     haltonfailure: [false]
    [flexunit]     headless: [true]
    [flexunit]     localTrusted: [true]
    [flexunit]     player: [flash]
    [flexunit]     port: [1024]
    [flexunit]     snapshot: [false]
    [flexunit]     snapshotFile: [---/controller/controller-shell/report/snapshot.jpg]
    [flexunit]     swf: [---/controller/controller-shell/bin/ControllerTestRunner.swf]
    [flexunit]     timeout: [60000ms]
    [flexunit]     toDir: [---/controller/controller-shell/report]
    [flexunit]     verbose: [true]
    [flexunit]     xcommand: [xvfb]
    [flexunit] Setting up server process ...
    [flexunit] Starting server ...
    [flexunit] OS: [Mac OSX]
    [flexunit] Opening server socket on port [1024].
    [flexunit] Waiting for client connection ...
    [flexunit] Launching player:
    [flexunit] Executing 'open' with arguments:
    [flexunit] '---/controller/controller-shell/bin/ControllerTestRunner.swf'
    [flexunit] The ' characters around the executable and arguments are
    [flexunit] not part of the command.
    [flexunit] Created local trust file at [/Users/arumsey/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust/flexUnit.cfg]
    [flexunit] Stopping server ...
    [flexunit] End of test data reached, sending acknowledgement to player ...
    [flexunit] Closing client connection ...
    [flexunit] Closing server on port [1024] ...
    BUILD FAILED
    ---/controller/build/macros.xml:64: java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report

  • HOW TO CONTROL ON CREATION OF SALES ORDER WITH REFERENCE TO EARLIER SO?

    Dear All,
    I want to contol on creation of Sales order with reference to earlier SO?  While creation of sales order our enduser are creating sales order with reference to earlier month SO which I want to restrict. Recently I made changes in sales order like payment terms is grayed, system will atomatically pick pay terms from customer master.Now I am getting correct data also but enduser is using old SO no while creating new SO and old payment data is reflecting in fbl5n.
    I want to restrict enduser while creating new SO with ref. to old SO. Only for returns they should be able to use Billing refrence. Pl. suggest how to control the with reference to ealier SO.
    Nikhil

    Nikhil Deshpande,
          If you dont want allow create a sales order in referent to other one, just delete the copy control between these sales order type, so when the user tries to create a SO in reference to other one a message is displayed that is not possible.
    Thanks,
    Mariano.

  • CRM Web UI :- How to Control number of session of Web UI for a user

    Hello Experts,
    We do have very specific requirement which SAP doesn`t recommend in terms of multi-sessioning for a user.So we are little worried upon the challeges.Could you please share your ideas/Experience on following?
    1.How to Control number of Internet explorer session for the web UI (may be 2 or 3).?
      Though SAP doesn`t recommned more than one but our client requires 2 or more than that but we need to fix it either 
      2 or 3.
      So we are looking for specific setting for this.
    2.What are the challenges we need to face if we implement option 1?
    3.Specially in interaction record management
        a. Is there chance of loosing the data if agent has opened more than two session.
        b. In which session interaction record data will get stored,the one on which agent picked up the call or in the latest 
            one?
    Please let me know if I am not clear enough on any point.
    Thanks in advance,
    Shailendra Tolambiya

    Hi Shailendra,
    The following wiki page might be useful in this respect:
    http://wiki.sdn.sap.com/wiki/x/gxdKDQ
    Best Regards,
    Shiromani

  • How to control my MacBook Pro with my iPhone ?

    I do wanna know how to control my Macbook pro just with my iPhone, please

    If you mean copy files from one to the other you can connect the two via firewire cable and boot one into Target Disk Mode.

  • How to control follow up doc for  Activities

    Hi...
    I have created 10 different types of Activitiy Doc. When I open any activity in crmd_order I'm getting all other activities as follow up docs(when I click on follow up icon). I dont want all of them, may be I need one or two out of those. How to control those can anyone have idea
    Regards,
    Ajay

    Hi,
    Check the copy control for transactions in
    spro-->Customer Relationship Management->Transactions->Basic Settings->Copying Control for Business Transactions->Define Copying Control for Transaction Types
    If the transactions are maintained as follow up for the transaction you have created then remove the entries which you dont want as follow up.
    Reward points if it helps.
    Shridhar

  • How to control DE USB disk Automounts.

    Hi,
    Can someone please guide me as to how to 'control' Automounts by DE when we plug USB disk drives.
    I have KDE4 on my Arch system. When I connect a pen drive/USB HDD which is formatted as vfat/NTFS, the system(or KDE) 'Automounts' it in /media and I have read/write access to it. But if I use the same drive and format it as ext4, it wont be mounted as read/write for normal users but only for root.
    Now pen drives and USB HDD's are removable storage drives and hence are volatile and could not have a fixed mount point, so it cannot be mounted by putting an entry in fstab or could they?. And I need my USB HDD frequently, and manually mounting it through CLI everytime and working on it as root is a bad idea i guess.
    I am posting this because m confused as to how to control this Automount feature-What is the backend to it? Because I've read that HAL no longer takes care of it and that HAL will be deprecated soon, instead UDEV takes care of it. If that is the case then should I be concerned about polkit? Because that is what's the output provided by Dolphin(freedesktop.org policy prevented blah blah).
    Another thing is if HAL is still in use and Automounts my devices then is it independent or polkit is a part of it. Then, is using hal-easy an option or replacement to standard HAL. ??!!??
    I tried HAL archwiki and used the code to give a user permission to give rw access to automounted ext filesystems, but then nothing is mounted, it sings the same old freedesktop.org prevented bla blah song. And I think this is a question for all linuxes using Gnome and KDE in general.
    Any help is appreciated.

    If by 'ability to mount as user' you mean to mount it manually but read/write access to normal users then yes. But primarily I need automounting as user, also be able to give access to other users for read/write et filesystem automounts.
    Last edited by kapz (2009-11-17 01:12:56)

  • How to control a NI USB 6210 from a Lab View program?

    Hi,
    I started today with Lab View with some earlier experience long ago.
    While it took me only about half an hour to get my first program running (great), installation time nor included (of course), I meanwhile read documents for some hours and cannot find out how to control measurement hardware in Lab View.
    I want to use a USB 6210 to set a 1-bit digital port. But at the moment there is no USB6210 available so I wanted to write (or do you say draw ?) the program without it and if possible simulate the hardware.
    I drew DAQ Assistant into my block diagram and selected digital line output but get "No supported devices found". I don't know if the appropriate driver was installed during Lab View installation.
    Also I don't understand the mechanism between DAQmx, tasks and the real hardware. Now I have a "Digital Bool 1Line 1Point" Control in my block diagram. How do signals get from program flow to hardware pin? How can I create a simulation for not connected hardware?
    Any help is greatly welcome
    Thanks a lot
    Martin

    Okay here is some more tutorials if you get some free time, specifically the hardware stuff will be relavent.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Launch MAX, it was known as Measurement and Automation Explorer, there should be a shortcut in your start menu / desktop.  Under devices and interfaces you can find your hardware and open test panels to control it.  This is the first place to ensure your hardware is working.  If the device isn't seen you'll need to install the drivers and DAQmx software.  If it is there, great.
    Now launch LabVIEW.  The easiest way to control hardware is using the DAQ Assistant.  It has many limitations and isn't recommended for large applications.  But for something quick and dirty it works fine.  You'll find it under the Measurement I/O >> NI DAQmx palette on the block diagram.  If it isn't there you may need to reinstall the DAQmx drivers.  This can happen if you installed DAQmx before LabVIEW.
    Also you'll find under Help >> Find Examples on the toolbar, many examples on controlling hardware.  Feel free to post some code if  you are having problems.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

Maybe you are looking for

  • How can i lock and unlock my daughter iphone 4S in a certain time

    I need to lock my daughter iphone at 8am and unlock at 4pm basically at school time, then lock againg at 9pm.

  • Using RMI from another language

    I've been playing around with an idea of connecting to some Java library with RMI from a another programming language. I know that deep inside RMI uses sockets to send the data, so any language supporting sockets should be able to use RMI as well, it

  • No Images Available In Boot Camp

    I have Mac Book Air 13 Inch with I7 and 8 GB Ram, I downloaded the windows 8.1 Pro ISO and using Boot Camp to Install. I successfully created Boot able USB with Windows 8.1 operating system using Boot Camp, But I'm getting No Images Available Screen

  • Show or hide a layer

    This question was posted in response to the following article: http://help.adobe.com/en_US/photoshopelements/using/WS287f927bd30d4b1f-f216bde12e28ad1224- 7ff5.html

  • Facing problem in selecting data based on the join s tatement ppls suggest

    hi cosider a sceneio as below there  are six tables    table1                                 table2                                  table3       table4                                                             table5 table6 join conditons between