Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 04-28-2002, 08:56 PM   #1
LQ Newbie
Registered: Apr 2002
Posts: 1

Rep: Reputation: 0
Question linux networking question

I have been racking my brain for the last couple of days to find an answer to this question, so here it is:

I am building a networking application (using poll()). I first wanted to figure out how poll worked, so I wrote some test code (very short). It segment faults whenever I run it, and I can't figure out why. I have tried it on several other distros, and flavors of *nix, including my universitys DIGITAL system with no luck.

------Here is my code-----------------------

#include <stdio.h>
#include <poll.h>
#include <stdlib.h>

struct ClientData {
char buffer[8192];

int main() {

pollfd ClientFds[1024];
ClientData socketdata[1024];

for (int x=0;x<1024;x++) {
ClientFds[x].fd = -1;
return 0;

any help would be greatly appreciated.

--------end of code-------
Old 04-29-2002, 07:40 AM   #2
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 46
Use malloc and free when you want to allocate large amounts of memory. You are trying to get a block of 8MB's by creating an array of ClientData.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux networking question m4dj4ck Linux - Networking 6 10-13-2004 10:21 AM
Slackware Linux 9.0 Networking Help (newbie question) Elimist Linux - Networking 1 11-15-2003 10:05 PM
Linux Networking Question/Problem tictocdoc Linux - Networking 4 10-17-2003 11:15 AM
Linux Networking 101 question CyberNet Linux - Networking 3 11-12-2002 07:53 AM
linux networking question jonathandavidso Linux - Networking 3 11-13-2001 02:04 PM

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration