How can I catch a connection reset with sockets and NSFileHandle

Hi,
I have an iPhone Client that connects to a remote server through a basic TCP Socket (Connected mode, ie SOCK_STREAM).
The communication pipe is then managed through an NSFileHandle.
Everything works fine as long as I don't reset the Server.
In that case, I receive an exception notification in X-Code Debugger. My problem is that I don't know how to catch (and thus manage) this exception:
*NSFileHandleOperationException, reason : [NSConcreteFileHandle readDataOfLength:] : connection reset by peer*
I tried something like that, but I never catch anything there, since I get there only when I have available data, and there are none since the server has closed.
@try{
incomingData = [ListeningSocket readDataOfLength:]
²catch(NSException * e){
NSLog("ReadDataOfLenght notified : %@ with reason : %@",[e name],[e reason])
Do some of you know how I can manage server reset to avoid getting and (unmanaged) exception?

You should consider using Bonjour based dynamic publishing and discovery of your service. So when the server service dies, and restarts, the client can detect the restart automatically and connect to the new address of the server.
Hope it helps. (Sorry for the belated response. . I just ran into this post).

Similar Messages

  • How can I create transparent animated  text with Motion and Final Cut Pro?

    Hi all,
    I am trying to replicate an effect that a previous video editor did in a project, but I can't contact them.
    They made animated text in Live Type, and saved it as a QT movie. When this text is placed over existing video in the FCP project, the text is "transparent", basically it acts like text created in FCP (You can see the background image behind the text, like through the middle of the letter "o").
    I have made some animated text in Motion, but when I save it as a QT movie, and bring it into FCP, the whole 1280x720 screen is covered by this movie, and I have to crop it so it does not cover the background image. It is all black except for the text. And of course the text is not on a transparent layer. Any ideas how I can create this effect with animated text? I've tried messing with transparency and overlay settings, nothing seems to work.
    Running latest version of Final Cut Studio...
    Thanks
    Dave

    Just bring the Motion (.motn) project into FCP and lay it over your clip.
    The QT you're exporting has to carry the alpha channel (animation codec, million+ colors), but don't waste your time/disk space with that. Just bring the motion project into FCP.
    Patrick

  • How can i make a connection between an application and a database over net

    dear sir
    how can i make connection between an appliction and a database over internet while the client side appliction is behind proxy and firewall
    for example how the live update of norton antivirus makes connection to the data server to make comparetions and get new virus definitions
    does that depend on sockets technology ?
    what references can guide me to the solution please?

    The ability to do so depends entirely on the JDBC driver implementation having some proxy method. It needs to recognize the HTTP or SOCKS proxy and use them to connect, and the firewall and proxy need to allow those specific port connections.
    To the best of my knowledge, all of these update utilities, e.g. live update for Netscape, Norton, etc., do not connect directly to the database. As it is, no sane security person would allow a database to be exposed to the Net. Rather, they connect using HTTP or HTTPS, which normally traverses firewalls just fine, to connect to a Web or application server on the far end. That application server then parses the request and retrieves whatever it needs to from the database.
    In other words, you cannot have a 2-tier client/server application. You need a 3-tier application:
    your client -> Web/app server -> database
    where the connection from your client to the Web/app server is over http or https through the firewall and proxies.
    Hope this helps.
    Avi
    dear sir
    how can i make connection between an appliction and a
    database over internet while the client side
    appliction is behind proxy and firewall
    for example how the live update of norton antivirus
    makes connection to the data server to make
    comparetions and get new virus definitions
    does that depend on sockets technology ?
    what references can guide me to the solution please?

  • How can I unlock my iPhone is with tmobile and I need it for att

    How can I use my iPhone 5 it was from t mobile store but I need it for AT&T

    Since you bought it from T-Mobile, T-Mobile will unlock the iPhone if you have had service wit T-Mobile for 45 days and the phone must be paid off through T-Mobile with no balance owed.
    This is for US bought T-Mobile iPhones in the US.

  • How can I make my Outlook sync with ical and address book on more than one mac?

    It currently syncs with my iMac through 'this computer' folder, but i dont have outlook on my macbook, so basically... how can i make my outlook automatically convert/sync to icloud enabled folders?
    Not too confusing i hope.

    Outlook won't work with iCloud. On your Mac.

  • How can I store a form name with path and then call form from a table

    Is it possible that any form that I built I store that form in some table in DB and then call that form from table, if yes, then how can i get this functionality. I am not very experience in form and do not know if it can be done because i think if it is possible then this can be a good security for application and easy to handle as well.
    Thanks in advance
    Maz

    If you have a Forms block based on this table:
    declare
      module varchar2(100);
    begin
      module := :block.column;
      call_form ( module ) ;
    end;If you don't have any blok based on that table
    declare
      module varchar2(100);
    begin
      select  module_name
      into module
      from ...
      where ...
      call_form ( module ) ;
    end;Francois

  • How can i sync my different emailaccounts with iphone and mavericks ?

    How can i sync my different email Accounts in Maveriks ?
    in itunes it seems not longer possible.

    Be sure all devices are logged into the same iCloud account and Mail is enabled.
    On the Mac:
    On the mobile devices:
    OT

  • How can I use the Connection Pool with DB2

    Hi All,
    I am facing the problem with the usage for the Connection Pool.
    I want to use DB2 via JNDI lookup.
    But when starting the Weblogic server, Error occured with the following message.
    <Error> <JDBC> <Cannot startup connection pool "MyJDBCPool" Cannot load driver class : com.ibm.db2.jdbc.app.DB2Driver>
    DB2 and Weblogic are on the same machine.
    In case of the use of remote DB2 database, I also encountered the same error.
    Configurations are as follows.
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver"
    MaxCapacity="10" Name="MyJDBCPool"
    Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test" URL="jdbc:db2://localhost:6789/yongjoo"/>
    <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool" Targets="myserver"/>
    Could you please give some information about this problem? I will appreciate your kindness.

    Hi Joe,
    Thanks your help.
    Perhaps It's my fault for Weblogic console's setting.
    After I reset the target server in console, Error message disappeared.
    But, when I call the TestCode, I encountered another error message. The error
    is NameNotFoundException.
    When lookingup the JNDI name, NameNotFoundException errer occured. I tried to
    change my setting and JNDI name, but the results are the same.
    Would you please give me some information about this one more time? I will be
    appreciated for your help.
    Follows are Config.xml
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver" MaxCapacity="10"
    Name="MyJDBCPool" Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test"
    URL="jdbc:db2://localhost:6789/yongjoo"/> <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool"
    Targets="myserver"/>
    and follows are TestCode,
    url = "t3://localhost:7001"; //default URL
    datasource = "jdbc/acsdb";
    Context ctx = null;
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, url);
    try{
    ctx = new InitialContext(p);
    System.err.println("initialContext(p)"+ctx); <-- success
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/acsdb");
    }catch(NameNotFoundException ne){
    throw new ConnectionException(); .
    }catch(NamingException ne){
    throw new ConnectionException();

  • How Can I Catching the new Company with Company_Changed Events

    Dear All
    I try to get the new company DB by sbodibs.company with Application Event (ItemChanged).
    Unfortunately, I always get the old one.
    Please kindly inform me asap.
    Thanks everyone.

    When a company is changed in the B1 desktop, you get an
    AppEvent. Usually, when you catch it, all you have to do
    is to redo the single-sign-on and then acquiring the new
    company.

  • How can I set my privacy tighter with Siri and Dictation?

    OK First of all, Apple needs to stop with the restriction of what you can say in posts. They keep deleting my stuff without allowing my QUESTION to be answered.
    First of all, when did this massive invasion of my privacy happen? Did it happen with the latest update to iOS 8.1? I know I did not have these pop ups until this update happened this week.
    I would like to know how to use Siri and Dictation WITHOUT such a massive invasion of my privacy?
    Did I ever have such privacy prior to iOS 8.1?
    I went to dictate a text message to my husband today and I get a pop up telling me that ALL my information is going to be shared. There is a "learn more" link and I click that and it has this long diatribe on how
    Apple takes the things I say and dictate and records them and sent to them to process my requests. My device will also send Apple other information, such as my name and nickname; the names, nicknames, and relationship with me (e.g. "my dad") of my address book contacts, song names in my collection, and HomeKit-enabled devices in my home (e.g., "living room lights") (collectively, your "User Data"). All of this data is used to help Siri and Dictation understand me better and recognize  what I say. It is not linked to other data that Apple may have from my use of other Apple services...
    there is a lot more but suffice it to say, it does NOT 'match' what is said about Siri and Dictation on the Apple privacy page. The phone privacy contract description has MORE things listed that are being recorded, used and stored.

    It only matches what I quoted. There is a lot more in the phone.
    I also had a lot more in my original post but Apple censored and then deleted it because they decided it was a rant.
    Apple's policy in my phone's privacy policy says a lot more.
    Apparently from your answer I am stuck with a massive invasion of my privacy? Are you so very comfortable with having everything you say recorded? What if you worked in a high security industry?
    I also asked if this was in effect prior to this latest update or not.
    What I had to omit. Check your phone's privacy page and compare to apple's web page I linked ( Settings > General > Keyboard >Dictation & Settings > General > Siri) and click on the About Siri or Dictation privacy...
    It goes on to tell me I can restrict Siri's and Dictation's ability completely by turning it off.
    It tells me that my personal information, voice recording and other things collected may be retained for a period of time to generally improve Siri, Dictation an functionality in other Apple products and services. <-- this right here contradicts the paragraph I quoted  by saying it indeed DOES use it for other Apple things. Also, HOW LONG is this "period of time"?
    If I want to 'erase' this information I can simply turn off then on Siri and or Dictation and lose what I have had recorded on me. THIS fully restarts the "learning" process all over again and in turn NEGATES all the stuff it learned in the past. The KICKER is that since apple "retains what it collects for a period of time" HOW does turning the services off truly "erase" what was taken in the past?
    Why can't the learning process be done directly on the phone itself without it being RECORDED and STORED by Apple?
    Now, before you go off and say how Apple respects my privacy, I know all of that. I just don't believe or trust it since all this iCloud hacking has been happening lately AND I am VERY conscious of what I put "out there" for all to see and take. I don't use social networking either due to the massive invasion of my privacy. Plus I find it silly. I will not be reduced to a low level of conversation where the simple "like" is the equivalent of a reply.

  • How can I Burn a Simple DVD with Chapters and Menus out of My Home Videos.

    I created an iMovie (unsig iMovie 10.0.2) of my daughter's volleyball season.  I inserted markers separating each game day, hoping these would create chapters in my DVD.  Then I did some research about DVD burning apps and finally downloaded BURN.  With Burn I created a DVD, but this DVD did not have chapters and also did not have a customizable menu.  The whole movie ended up as one 2 hour long chapter.
    I have hundresd of family vacation on a hard drive stored and would like to start making iMovies of them to put on DVD for easy watching and forbackup  storing.
    What is a simple way I can burn my iMovie with chapters onto a DVD?
    My macbook pro did not come with iDVD so I dont have it.
    Thanks.

    MY source is HD i beleive. I shot videos with an iPad Mini.
    I ventured into this because I offered this DVD to several team parents, so they are waiting for me to give them the DVD.  While I was making it, I added subtitles, showing the game dates, game scores and stats of each player, so it came out really nice.  However, not to concern about quality, i have burt the video in a dual layer dvd in SD.  I dont have a blue ray burner nor media.
    This made me want to do the same with my family vacations vieeos, whic now are a bunch of files in a hard drive, sort them by vacation and add titles like lications to actualy be abel to watch them on a dvd someday.
    I have apple tv in the family room, but do not use to watch these videos, will look into that. However, I would still want to make the DVD's.
    It seems odd how this, basic feature, has been dropped. I guess apple does not want us to use any more discs.
    Still hoping I can do this, if not, I will have to gie away the DVDs with the 2 hour long video in a single chapter.

  • How can i use external hard drive with mac and pc!

    I've been using a Lacie external hard drive with my mac to keep the itunes library and other things since day one. Since i have a dvd with files for windows and an old pc without a dvd drive, i decided to copy and paste the content of the dvd to the external hard drive. The only problem now is that when i plug the external hard drive to pc, it won't open. I know it has to be formatted in a different way, but i need to find out the best solution!
    Any idea?

    You can format the external drive in Fat32 (which I don't recommend but is the most compatible between both platforms), or NTFS (which requires some work to get your Mac to recognize), or HFS+ (which requires special software on your PC so your PC can use it).
    If you use this drive mostly with your Mac, get MacDrive for your PC:
    http://www.mediafour.com/products/macdrive
    If you use this drive mostly with your PC, here's some software for you Mac. I haven't tried this myself, but the professional reviews have been good:
    http://www.paragon-software.com/home/ntfs-mac/

  • How can I make ANY vector  graphics with graphics2D and save on clipboard?

    I am at my wits end here, and need some help. Simply put, I have a program that creates a basic x-y graph, drawn in a jpanel. I want to create the graph as a vector (emf, eps, svg, I don't care anymore, any of them would be good). But, all I get is a jpg or bitmap.
    I tried using the infamous FreeHEP programs, but it won't recognize the output as anything but "image" which means bitmap/jpg.
         The user enters x/y data, clicks a button, which crreates a jpanel thusly:
    public class GraphMaker extends JPanel {
    static BufferedImage image = new BufferedImage(600, 500, BufferedImage.TYPE_INT_ARGB);
    GraphMaker(double[] xVals, double[] yVals, double[] sems){
    setPreferredSize(new Dimension (600,500));     
    symSize = 10;
    XminV = 0;
    XmaxV = 0;
    // code here just converts input x and y's to pixel coordinates, spacing of ticks, etc...
    for (int i =0;i < ArLn; i++){
    gX[i] = xO + (gX[i] * xRat);
    gX[i] -= xStart;
    gY[i] = gY[i] * yRat;
    gY[i] = yEnd - gY;
    semVal[i] = semVal[i]*yRat;
         Ymin = yEnd - (Ymin*yRat);
         Ymax = yEnd - (Ymax*yRat);
    BufferedImage anImage = new BufferedImage(600, 500, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = anImage.createGraphics();
    g2.setBackground(white);
    g2.setColor( Color.WHITE );
    g2.fillRect(0,0,600,500);
    g2.setStroke(stroke);
    // here I use the values to draw lines and circles - nothing spectacular:
              g2.setPaint(Color.blue);
              int ii = 0;
              for ( int j = 0; j < ArLn[ii]; j++ ) {
    g2.fill(new Ellipse2D.Float(LgX[ii][j] - symOffst, gY[ii][j]-symOffst, symSize,symSize));
    g2.draw(new Line2D.Float(LgX[ii][j],(gY[ii][j]-semVal[ii][j]),LgX[ii][j],(gY[ii][j]+semVal[ii][j])));
    g2.draw(new Line2D.Float(LgX[ii][j]-2.0f,(gY[ii][j]-semVal[ii][j]),LgX[ii][j]+2.0f,(gY[ii][j]-semVal[ii][j])));
    g2.draw(new Line2D.Float(LgX[ii][j]-2.0f,(gY[ii][j]+semVal[ii][j]),LgX[ii][j]+2.0f,(gY[ii][j]+semVal[ii][j])));
                        g2.draw(new Line2D.Float(xLoVal[ii],yLoVal[ii],xHiVal[ii],yHiVal[ii]));
    image = anImage;
    And, when the user clicks on the "copy" button, invokes this:
    public class Freep implements Transferable, ClipboardOwner {
         public static final DataFlavor POSTSCRIPT_FLAVOR = new DataFlavor("application/postscript", "Postscript");
         private static DataFlavor[] supportedFlavors = {
              DataFlavor.imageFlavor,
              POSTSCRIPT_FLAVOR,
              DataFlavor.stringFlavor
         private static JPanel chart;
         private int width;
         private int height;
         public Freep(JPanel theGraph, int width, int height) {
              this.theGraph = Graphs;
              this.width = width;
              this.height = height;
    //******This is the key method right here: It is ALWAYS imageFlavor, never anything else. How do I make this an EPS flavor?
         public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
    if (flavor.equals(DataFlavor.imageFlavor)) {
    return GraphMaker.image;
    else if (flavor.equals(POSTSCRIPT_FLAVOR)) {
                   return new ByteArrayInputStream(epsOutputStream().toByteArray());
    else if (flavor.equals(DataFlavor.stringFlavor)) {
                   return epsOutputStream().toString();
              } else{
                   throw new UnsupportedFlavorException(flavor);
         private ByteArrayOutputStream epsOutputStream() throws IOException {
    EPSDocumentGraphics2D g2d = new EPSDocumentGraphics2D(false);
    g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
         public DataFlavor[] getTransferDataFlavors() {
              return supportedFlavors;
         public boolean isDataFlavorSupported(DataFlavor flavor) {
              for(DataFlavor f : supportedFlavors) {
                   if (f.equals(flavor))
                        return true;
              return false;
         public void lostOwnership(Clipboard arg, Transferable arg1) {
    The same happens with FreeHEP - I want the flavor to be EMF, but the program sees an image so it is always imageFlavor. I know I am missing something, but what, I don't know.
    thanks for your help.

    I don't think there's a built-in solution. One workaround I've seen is to create a dummy graphics class that overrides the desired drawing functions. Instead of actually drawing pixels, the object writes postscript commands to a buffer. There also seems to be commercial code that does exactly this.

  • How can I delete an Inbound Delivery with HUs and Confirmed TOs?

    Hello Guys,
    My client  has an Inbound delivery created from a PO line item. The goods receipt could be reversed through Vl09N so a 102 material document has been created. The problem now is that he wants to delete the ID (Vl32N) and it still has OTs confirmed with HUs created. Do you think it could be possible to delete this Inbound Delivery? Which would be the correct steps???
    Please ADVICE!

    Hi,
    Not possible to delete the IBD if it has material GR done and confirmed TO.
    \\ Shankar

  • How can one get java to work with SnowLeopard and FF13

    SInce the install of the most recent Java update (9)  for SnowLeopard (10.6.8) Firefox 13 simply advises that there is no plugin installed.  The behavior the update indicates will take place (where the web page provides the option to enable the plugin) simply has never presented itself. At this point, java is simply no longer available on a Mac running SNowLeopard and using Firefox.  Is there a solution to this other than upgrading to Lion?

    Yes. However, do note that FF is only on the machine for testing, I don't use it, preferring Safari. Any further issues with FF are best answered at http://support.mozilla.org/

Maybe you are looking for

  • Hr scenario urgent....

    Is it possible to perform all HR Actions (Hire, Transfer, Pay Increases, Terminationsu2026..) through  a 3rd party software and that this information be loaded into the SAP System to support Time and Attendance inside SAP? means they want Time Manage

  • How do i change the size of the flexible space in tool bar

    if the feature, "flexible space", to customize the tool bar is truly "flexible", then how do i change the size of it?

  • Steps for deleting release stretagy for Purchase Order

    Hi, Could you please help in deleting / cancelling the exisiting PO release stretagy? I need to create new release stretagy which is totally different from the existing one. What are the steps in cancelling existing release strategy. Can the same ste

  • Nexus 5500 - inband via default vrf and out-of-band via management vrf

    Nexus 5548 with no layer 3 module.  Want to manage the device via 10.122.122.5 9 (inband) and 10.122.123.58 (out-of-band) Currently i can get to the device using 10.122.123.58 via management vrf but can't get to 10.122.122.5 via default vrf. A couple

  • ALV List, which one is better?

    Hi All, I need a suggestion which type of ALV(Block, hierarchy, etc...) is Best for given situation below. I am showing data in ALV with respect to multiple Vendors. There are multiple line items to single Vendor and then Summary of printed line item