Re: [CODE] Sockets...Anybody? Help?

From: George (greerga@circlemud.org)
Date: 11/10/98


On Tue, 10 Nov 1998, Jourge Fuzz Bush wrote:

>> Missing a "do"

>Actually,while loops works fine without do commands.

Sure, but it's _ugly_.

>And the sendcmd function works fine. I dedcided to write my own function
>like write_to_descriptor because that function had no error checking of
>how much data got sent compaired to how much data there was.

Why not just change:

  return 0;

to

  return bytes_written;

You won't even have to change any other code.

>Anyways that wasn't the origional problem and I still get the same problem
>with write_to_descriptor. See after the first send of data I have to
>receive. Then send. Then send. Then I don't know I tried send and I tried
>receive then send but neither works. It's something to do with stream size
>I belive or the receiving smpt client.

You have to stick the stuff in the player's queue, place the person in a
special CON_ state, and wait for the data.  You can't just read from the
socket because it's non-blocking and may not arrive for a long time.  Then
when you're back into nanny() for the new CON_ state, you do more
processing, send stuff, and place them in another CON_ state.  Repeat until
you're done and they are placed back in CON_PLAYING.

>So. Unless someone has an idea of how to fix that.....
>This is using msvc++ 5.0 on win95.

Do it the right way. :)

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://mouse.van.ml.org/   (mostly) | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST