Search Results

Search: Posts Made By: ctote
Forum: Programming 01-26-2011
7,339
Posted By Corona688
Not just that method -- every method that takes...
Not just that method -- every method that takes an int st parameter. I know for sure now -- they will all segfault on this platform, for the same reason, because an integer is not large enough to...
Forum: Programming 01-25-2011
7,339
Posted By Corona688
Try fprintf(stdout,...) instead of stderr. We...
Try fprintf(stdout,...) instead of stderr. We really need to know.
Forum: Programming 01-25-2011
7,339
Posted By Corona688
From the looks of it... that might be a good...
From the looks of it... that might be a good idea. It's not too bad when you look at small bits but when you see how it's put together, the code you've posted is :wall: after :wall: after :wall:
Forum: Programming 01-25-2011
7,339
Posted By Corona688
On many platforms, sizeof(void *) > sizeof(int). ...
On many platforms, sizeof(void *) > sizeof(int). These will chop that pointer in half and cram the remnants into your function through the mail slot when you pass as int.

This won't crash...
Forum: Programming 01-25-2011
7,339
Posted By Corona688
[edit] third time's the charm. Gah. What is the...
[edit] third time's the charm. Gah. What is the value of pst? What does it point to?
Forum: Programming 01-24-2011
7,339
Posted By Corona688
That is a very bizzare place for it to crash... ...
That is a very bizzare place for it to crash... for it to crash there, just doing FD_ZERO, means the object itself may have ended up an invalid pointer somehow.

Yes, you shouldn't be making a new...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
Try putting fprintf(stderr, "debug...
Try putting fprintf(stderr, "debug statements\n"); inside that function so you can tell at what points its still running.
Forum: Programming 01-24-2011
7,339
Posted By Corona688
Okay, so the second parameter is the port number,...
Okay, so the second parameter is the port number, or service name, in the form of a character string.

Not all mail servers have the same port, I'm not sure it's safe to ignore it. Never...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
ok, good. I don't think that warning's related. ...
ok, good. I don't think that warning's related.

But, you definitely need to set the_socket=sockfd before you return. The class won't happen to just know what socket you opened -- you have to...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
I think you're supposed to do the_socket=sockfd;...
I think you're supposed to do the_socket=sockfd; after you open the connection. Otherwise the class will have no idea it's supposed to use the socket you just opened.

I have no idea what's...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
So you open the socket, but don't keep it. And...
So you open the socket, but don't keep it. And when later code tries to use it, it uses an empty, default, or garbage value instead of the socket you opened... which wouldn't cause a crash...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
When I pasted this into a C function it...
When I pasted this into a C function it complained about two undefined variables -- fds, and timeout. That's it.

So, I don't think you're actually storing the socket you opened into the class...
Forum: Programming 01-24-2011
7,339
Posted By fpmurphy
// fill the area of memory taken by serv_addr...
// fill the area of memory taken by serv_addr structure with zeros
bzero((char *) &serv_addr, sizeof(serv_addr));

// set the sin_family member of serv_addr to AF_INET (IP Address Family)...
Forum: Programming 01-24-2011
7,339
Posted By Corona688
And now you learn the crucial difference between...
And now you learn the crucial difference between "compiles" and "does what I thought it did"..

Did you do #include <string.h>, for starters?

Taking a closer look at the code now...
Forum: Programming 01-21-2011
7,339
Posted By Corona688
that means 'directory not empty'. It's likely...
that means 'directory not empty'. It's likely totally unrelated to the bit of code you're playing with. If you put a perror() too late, errno could have been trashed by any other system call that...
Forum: Programming 01-20-2011
7,339
Posted By Corona688
If you're using memcpy but not including...
If you're using memcpy but not including string.h, that is easily capable of causing a segmentation fault on some platforms.

Turns out there is a strings.h though, it defines bcopy.
Forum: Programming 01-20-2011
7,339
Posted By Corona688
Never use Windows documentation to program an AIX...
Never use Windows documentation to program an AIX system! When I said it only vaguely adhered to the standard, I wasn't kidding. ;) It's a bit skewed compared to what you get on a UNIX system.
...
Forum: Programming 01-20-2011
7,339
Posted By Corona688
You forgot to give me the entire line that caused...
You forgot to give me the entire line that caused the error, too. None of that should have made it think it was an int, that's odd.

---------- Post updated at 04:21 PM ---------- Previous update...
Forum: Programming 01-20-2011
7,339
Posted By Corona688
bcopy works like bcopy(source, dest, length); ...
bcopy works like bcopy(source, dest, length);
memcpy works like memcpy(dest, source, length);

So you have to swap the first two. Otherwise they're equivalent. I considered replacing that for...
Forum: Programming 01-20-2011
7,339
Posted By Corona688
Yes, and the perror() command I suggested above...
Yes, and the perror() command I suggested above checks errno to tell what it should print. errno is a global variable that's set by system calls, so when most any system call returns an error,...
Forum: Programming 01-20-2011
7,339
Posted By Scott
Hi. From the connect(2) man-page: ...
Hi.

From the connect(2) man-page:

RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the global inte-
ger variable errno...
Forum: Programming 01-20-2011
7,339
Posted By Corona688
None of that winsock stuff matters unless...
None of that winsock stuff matters unless INCL_WINSOCK_API_PROTOTYPES is defined -- it's probably safe to ignore. Windows does in fact have a socket API that vaguely resembles the expected standard,...
Forum: Programming 01-20-2011
7,339
Posted By citaylor
I would try printing the value of "errno" to find...
I would try printing the value of "errno" to find out why the socket didnt connect.
I would also have a look at "the_socket" to make sure it is >= 0.
Then I would also look at the contents of sa_in...
Showing results 1 to 23 of 23

 
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy