Re: Recv on a socket
From: coardump (coardump_at_gmail.com)
Date: 03/15/05
- Next message: John Smith: "Re: triggering an event every 5 minutes in C"
- Previous message: Jon Zero: "triggering an event every 5 minutes in C"
- In reply to: Rainer Temme: "Re: Recv on a socket"
- Next in thread: Måns Rullgård: "Re: Recv on a socket"
- Reply: Måns Rullgård: "Re: Recv on a socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Mar 2005 09:12:54 -0800
Hey Rainer, thanks for the reply!!
Rainer Temme wrote:
> Hi coardump (a real name would certainly be preferred ...
:-)
> > socksnarf(bytes, sockfd, buf);
> > if(!socksnarf) {
> > perror("socksnarf");
> > _exit(ERR);
> > }
> Since socksnarf is a function the "if (!socksnarf)"
> would only be executed if the pointer were NULL ...
> in this case the program would non even have compiled.
> Yes, I know that pascal is different ... but this is C.
Over zealous debugging :-) I only code c, so I have bad habbit's
already huh.
>
>
> > Snarfed:
> > Data aaaaa
> >
> > Size 6
>
> It is not overly easy to see, but nevertheless still visible,
> that "aaaaa" + "\n" was displayed in the "snarf" output ...
> the newline in the data is where the additional Newline comes
from
> that is not in the fprintf-format. So, the length of 6 is ok.
OK, what I want is NOT to count the \n so that I get output as such:
Snarfed:
Data aaaaa
Size 5
meaning I do not count the \n as output and I also loose the space
between Data and Size seen in my example. Basically stripping the new
line recieved from the server.
Only way I can think of doing it, keeping in mind I need to retain the
dynamic effect would be to use strstr() to find any instances and
remove it manually before passing it to fprintf. Any better methods to
achieve what I want?
>
> Your code didn't show the server-side at all ...
> I wouldn't be amazed is "I don't know you, go away" would have
been
> the string snarfed.
I'm running the code agains a netcat listener on port 22 on my
workstation, that's all.
thanks
coardump.
- Next message: John Smith: "Re: triggering an event every 5 minutes in C"
- Previous message: Jon Zero: "triggering an event every 5 minutes in C"
- In reply to: Rainer Temme: "Re: Recv on a socket"
- Next in thread: Måns Rullgård: "Re: Recv on a socket"
- Reply: Måns Rullgård: "Re: Recv on a socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]