• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NetSocket question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NetSocket question


  • Subject: NetSocket question
  • From: AndrĂ© Lind <email@hidden>
  • Date: Fri, 4 Feb 2005 10:20:44 +0100

Anyone who can help me with a small problem Im having with my NetSocket connection?
If I try to send files over my netsocket connection my program uses a *lot* of memory so I guess it loads
the entire file Im sending into memory...
Another problem is that I cannot use autorelease or release on any variables because then my i crashes completely.
Any ideas what to do?
Heres the code anyway if you want to take a look at it:


<x-tad-smaller> -(void)sendFile {
NSData *readData; readData = [outgoingHandle readDataOfLength:1024*16];

NSLog(@"Sending File");
[transferSocket writeData:readData];
}

- (void)netsocketConnected:(NetSocket*)inNetSocket {
[inNetSocket retain]; NSLog( @"FileTransfer: Connected" ); [self sendFile];
}

- (void)netsocket:(NetSocket*)inNetSocket connectionTimedOut:(NSTimeInterval)inTimeout { NSLog( @"FileTransfer: Connection timed out" );
}

- (void)netsocketDisconnected:(NetSocket*)inNetSocke t { NSLog( @"FileTransfer: Disconnected" ); }

- (void)netsocket:(NetSocket*)inNetSocket dataAvailable:(unsigned)inAmount {
NSLog(@"Incoming Data");

NSData *readData = [inNetSocket readData:inAmount];

NSLog(@"Writing Data");
[incomingHandle writeData:readData];
}

- (void)netsocketDataSent:(NetSocket*)inNetSocket { NSLog(@"Data sent");

[inNetSocket retain];
[inNetSocket scheduleOnCurrentRunLoop];

[self sendFile];
}


André</x-tad-smaller>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: NSToolbar(item) quirk
  • Next by Date: Resizing text views and flowing controls
  • Previous by thread: How to show Newly added Object in the outline view
  • Next by thread: Resizing text views and flowing controls
  • Index(es):
    • Date
    • Thread