Sponsored Content
Special Forums IP Networking recvfrom() causes segmentation fault Post 302324180 by lameduck0123 on Wednesday 10th of June 2009 07:21:53 AM
Old 06-10-2009
recvfrom() causes segmentation fault

hi all....
i wrote a program with udp sockets..
when it reaches the function 'recvfrom()' it crashes with a core dump.
the gdb trace says the following error msg...

Core was generated by `/opt/fmp'.
Program terminated with signal 6, Aborted.
#0 0x00000055555b18e4 in recvfrom () from /lib64/libpthread.so.0
(gdb) c
The program is not being run.
(gdb) bt
#0 0x00000055555b18e4 in recvfrom () from /lib64/libpthread.so.0
#1 0x00000001200054fc in ParseExecuteCommand (sock=6) at ../src/command_mgmt.c:92
#2 0x0000000120004f30 in main (argc=1, argv=0xffffd685f8) at ../src/main.c:586

can anybody tell me when 'recvfrom()' can cause segmenation fault?????
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Segmentation Fault

hello all, I tried a program on an array to intialise array elements from the standard input device.it is an integer array of 5 elements.but after entering the 4th element it throws a message called "Segmentation Fault" and returns to the command prompt without asking for the 5th element. ... (3 Replies)
Discussion started by: compbug
3 Replies

2. AIX

Segmentation fault

Hi , During execution a backup binary i get following error "Program error 11 (Segmentation fault), saving core file in '/usr/datatools" Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies

3. UNIX for Dummies Questions & Answers

Segmentation Fault

Hi, While comparing primary key data of two tables thr bteq script I am getting this Error. This script is a shell script. *** Error: The following error was encountered on the output file. Script.sh: 3043492 Segmentation fault(coredump) Please let me know how to get through it. ... (5 Replies)
Discussion started by: monika
5 Replies

4. Programming

segmentation fault

What is segmentation fault(core dumped) (1 Reply)
Discussion started by: gokult
1 Replies

5. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

6. Programming

segmentation fault.

This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b: int main() { mysqlpp::Connection conn(false); if... (3 Replies)
Discussion started by: sepoto
3 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Homework & Coursework Questions

Segmentation Fault

this is a network programming code to run a rock paper scissors in a client and server. I completed it and it was working without any error. After I added the findWinner function to the server code it starts giving me segmentation fault. -the segmentation fault is fixed Current problem -Also... (3 Replies)
Discussion started by: femchi
3 Replies

9. Programming

Segmentation fault

I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me. For example this code #include <stdio.h> main() { unsigned long a=0; unsigned long b=0; int z; { printf("Enter two... (2 Replies)
Discussion started by: sizzler786
2 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
recvfrom(2)							System Calls Manual						       recvfrom(2)

NAME
recvfrom - Receives messages from sockets SYNOPSIS
#include <sys/socket.h> ssize_t recvfrom( int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len) ; [XNS4.0] The definition of the recvfrom() function in XNS4.0 uses a size_t data type for the address_len parameter instead of a socklen_t data type as specified in XNS5.0 (the previous definition). [Tru64 UNIX] The following definition of the recvfrom() function does not conform to current standards and is supported only for backward compatibility (see standards(5)): int recvfrom( int socket, char *buffer, int length, int flags, struct sockaddr *address, int *address_len) ; STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: recvfrom(): XNS5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the socket file descriptor. Specifies a pointer to the buffer to which the message should be written. Specifies the length (in bytes) of the buffer pointed to by the buffer parameter. Points to a value that controls message reception. The parameter to control mes- sage reception is formed by the logical OR of one or more of the following values: Peeks at the incoming message. Processes out-of-band data. Requests that the function block wait until the full amount of data requested can be returned. The function may return a smaller amount of data if a signal is caught, the connection is terminated, MSG_PEEK was specified, or an error is pending for the socket. Points to a sockaddr structure, the format of which is determined by the domain and by the behavior requested for the socket. The sockaddr struc- ture is an overlay for a sockaddr_in or sockaddr_un structure, depending on which of the supported address families is active. [Tru64 UNIX] If the compile-time option _SOCKADDR_LEN is defined before the sys/socket.h header file is included, the sockaddr structure takes 4.4BSD behavior, with a field for specifying the length of the socket address. Otherwise, the default 4.3BSD sock- addr structure is used, with the length of the socket address assumed to be 14 bytes or less. If _SOCKADDR_LEN is defined, the 4.3BSD sockaddr structure is defined with the name osockaddr. Specifies the length of the sockaddr structure pointed to by the address parameter. DESCRIPTION
The recvfrom() function permits an application program to receive messages from unconnected sockets. It is normally applied to unconnected sockets because it includes parameters that permit a calling program to retrieve the source endpoint of received data. To obtain the source address of the message, specify a nonzero value for the address parameter. The recvfrom() function is called with the address_len parameter set to the size of the buffer specified by the address parameter. On return, this function modifies the address_len parameter to the actual size in bytes of the address specified by the address parameter. The recvfrom() function returns the length of the message written to the buffer pointed to by the buffer parameter. When a message is too long for the specified buffer, excess bytes may be truncated depending on the type of socket that issued the message, and depending on which flags are set with the flags parameter. When no message is available at the socket specified by the socket parameter, the recvfrom() function waits for a message to arrive, unless the socket is nonblocking. When the socket is nonblocking, errno is set to [EWOULDBLOCK]. Use the select() and poll() functions to determine when more data arrives. NOTES
[Tru64 UNIX] When compiled in the X/Open UNIX environment or the POSIX.1g socket environment, calls to the recvfrom() function are inter- nally renamed by prepending _E to the function name. When you are debugging a module that includes the recvfrom() function and for which _XOPEN_SOURCE_EXTENDED or _POSIX_PII_SOCKET has been defined, use _Erecvfrom to refer to the recvfrom() call. See standards(5) for further information. RETURN VALUES
Upon successful completion, the byte length of the written message is returned. If no messages are available and the peer has closed the connection, the recv() function returns a value of 0. Otherwise, the function returns a value of -1 and sets errno to indicate the error. ERRORS
If the recvfrom() function fails, errno may be set to one of the following values: The socket parameter is not a valid file descriptor. A connection was forcibly closed by a peer. Nonexistent or protected address space is specified for the message buffer, sending address, or address length. [Tru64 UNIX] A valid message buffer was not specified. A signal interrupted recvfrom before any data was available. The MSG-OOB flag is set and no out-of-band data is available. An I/O error occurred while reading from or writing to the file system. Insuffi- cient resources are available in the system to complete the call. The system did not have sufficient memory to fulfill the request. The available STREAMS resources were insufficient for the operation to complete. A receive is attempted on a connection-oriented socket that is not connected. The socket parameter refers to a file, not a socket. The specified flags are not supported this socket type. The connection timed out during connection establishment, or due to a transmission timeout on active connection. The socket is nonblocking; no data is ready to be received. The MSG_OOB flag is set, no out-of-band data is available, and either the socket is nonblocking or does not support blocking to await out-of-band data. RELATED INFORMATION
Functions: read(2), recv(2), recvmsg(2), select(2), send(2), sendmsg(2), sendto(2), shutdown(2), socket(2), write(2). Standards: standards(5). delim off recvfrom(2)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy