Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

Socket Progamming Problem

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2006, 10:14 AM
Default Socket Progamming Problem




I've got a problem that I don't know how to get around. I've written a
client socket application in C, but I'm having problems getting it to work
properly.

I have a separate thread that reads the socket and puts the data in a
buffer. The main thread looks for data and processes it accordingly.

There is a ppp connection over an unreliable network. If the main thread
doesn't get an application level ack to data sent, it closes the socket,
restarts ppp, and opens a new socket when ppp is up again.

Sometimes the new socket works, sometimes it doesn't. Sometimes the
tcp-read gets a read of 0 bytes indicating that the connection is closed,
and all is well. But sometimes it remains blocked, so the application
writes to the new socket, but is blocked on the old.

I'm not sure how to get around this. I'm probably doing it all wrong.
Any suggestions would be appreciated, or any links to some example code.
There are lots of simple socket examples, but I haven't been able to find
anything to help me in this situation.

Thanks

Dan


Dan N
Reply With Quote
Reply

Tags
problem, progamming, socket

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 01:46 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.