LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2008, 07:11 AM   #1
antro-xlove
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 0
Network Programming Problem


hi all
i have a question about network programming for u who can help me,
when i write some network program (usually using qt gui, socket), then i compiled and running as root, i got Segmentation Fault ( both su and sudo ), but running normal if using normal user, is thereis any one know the solution ?
 
Old 05-29-2008, 07:29 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Use the versions of the libraries etc with debug symbols intact, then compile your software and run it under 'gdb' and find out what causes the segfault.
 
Old 05-29-2008, 07:45 AM   #3
antro-xlove
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Original Poster
Rep: Reputation: 0
thanks for replay
actually i never use gdb at all because i am win32 gui programming before ( i use ollydbg ).
I get same problem with precompiled one, the program is cafe billing (the client) that can lock client desktop on my Internet Cafe, if i execute the program using normal user then my user with little knowledge of unix can kill it either via shell or the others, any soluition
 
Old 05-31-2008, 02:56 AM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
I don't see what solution you can have except to run it as 'root' and attach a debugger to find out where you get the segfault. It sounds suspiciously like a pointer is freed, then accessed again later. If no one else changes that memory and it isn't reclaimed by the kernel memory manager everything will be fine, but if it is altered for any reason then strange things can happen. The 'segfault' sounds like the memory was reclaimed by the kernel, so when the 'page' that it was on was accessed, a segfault was generated. Normally if you are accessing a page which was allocated to you, the page would be made available and the program goes on running (segfaults are normal program operation - as long as the kernel knows how to handle it), but since the kernel doesn't believe that address has been allocated to you, the process is killed with a segfault.
 
Old 06-02-2008, 12:06 AM   #5
antro-xlove
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Original Poster
Rep: Reputation: 0
try the qt3 distribution network example, nothing wrong with the code, just doesnt work to run as root via su or sudo, acctually i am still lazy to grab debug library version in my computer, i am not really like to use gdb (cli debugger) too, another example is that i was try is zeiberbude (http://packages.debian.org/zeiberbude
the client one, it just tell me that "Segmentation Fault" was occur, i think this is about Environtment one, not the code, i not try yet but how if i am login as root through normal login not su or sudo, it could be work ??? I will try later
 
  


Reply



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
Network Programming Peter_APIIT Programming 12 06-10-2008 04:43 AM
Help: network programming in c rashmirathi Programming 3 03-11-2008 10:11 AM
Network Programming myrto Linux - Newbie 2 12-22-2006 04:37 AM
network programming using C bastin_gh Programming 4 06-29-2005 05:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:13 AM.

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