LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Somebody lend a hand to figure out what's the problem on Solaris (http://www.linuxquestions.org/questions/programming-9/somebody-lend-a-hand-to-figure-out-whats-the-problem-on-solaris-784622/)

lambert 01-25-2010 11:04 AM

Somebody lend a hand to figure out what's the problem on Solaris
 
Hi guys,

My tcp socket server which i developed under cygwin couple of days ago had a problem of recieving command from a client on solaris. The server is supposed to realize authentication and products listing sort of functions and so forth. There is no problem when i execute server and client under cygwin. The weird thing is every time when i send a "L" command which means want to list the products on the server side. The client process is closed by the server. Here is what i copied from the terminal: "Connection to 127.0.0.1 closed by foreign host", and the server side has saying goes like this:"Children 11800 terminated with status 138", and generate the core which may have something wrong in the memory?

I've been checking online to see what this status 138 means. So far, several explainations may give a hint. 1:buffer size exceed the size of vitual memory? 2:dereferencing pointer to a incomplete type(i saw it online)? 3:NFS write error on host variable: No space left on
device(I use df command to check there is much more space than i expected ).
Now i don't know why it happend. Somebody lend a hand???

Waiting online!!!

BTW:solaris version is Solaris/SPARC 9

David1357 01-25-2010 01:17 PM

Quote:

Originally Posted by lambert (Post 3839920)
Waiting online!

Are you checking the return values of all of your socket functions (i.e. socket, connect, recv, etc.) and printing out the string value of any errors you see using strerror?

For example:
Code:

    result = recv(socket, buffer, length, flags);
    if (-1 == result)
    {
        fprintf(stderr, "ERROR: recv failed: %s\n", strerror(errno));
        // TODO: Handle the error gracefully (e.g. close the socket
        // and exit the program)
    }


lambert 01-25-2010 07:49 PM

Quote:

Originally Posted by David1357 (Post 3840059)
Are you checking the return values of all of your socket functions (i.e. socket, connect, recv, etc.) and printing out the string value of any errors you see using strerror?

For example:
Code:

    result = recv(socket, buffer, length, flags);
    if (-1 == result)
    {
        fprintf(stderr, "ERROR: recv failed: %s\n", strerror(errno));
        // TODO: Handle the error gracefully (e.g. close the socket
        // and exit the program)
    }


good point David, Thanks for your remind. I'll do that:)

ta0kira 01-25-2010 10:13 PM

Some of the POSIX-defined structures differ from system to system, e.g. the ordering of members of struct flock differs between glibc and FreeBSD; therefore, make sure you're explicitly initializing members of such structs (if applicable.) The networking-related operations seem especially susceptible to this sort of thing because of the extensive use of structs. Did you have any build warnings on Solaris? Did you run a backtrace on the core dump? That should tell you where the problem is, provided you built with debug symbols.
Kevin Barry

lambert 01-31-2010 03:55 AM

Problem solved
 
Sorry for late response, The problem has been solved. The problem results from the size differentiation of pointer between 32bit OS and 64bit OS. Thank you guys for your kind help!!!


All times are GMT -5. The time now is 06:42 PM.