LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2004, 07:37 AM   #1
rajesh_bachani
LQ Newbie
 
Registered: Jun 2004
Posts: 1

Rep: Reputation: 0
Exclamation some basic queries..


hi friendzz..i had a set of queries..generally relating to linux and programming in c..

1.shutdown command..
how do i shutdown the computer from the shell prompt using this command..
i tried shutdown all..but it just exited the kde and showed me some other non-graphical inteface..

2.minimal use of root..
i was going through a tutorial on intro of linux..
in that i found this this mentioned several times..that the root account must be used only when u really need it..i normally work on the root only all the time..havent made any special account as such for my daily working..so is that a bad habit really..??

if yes then why is it so..??

3.databases in c..
can i manage databases through c..??
i havent till now found that feature in any of the c docs..so if thats a yes where do i find it..??
and if no..is there any other way to interact with databases with c compatibility..??

4.printer port..
is it possible to write a socket program for directly sending data to the printer port..i tried this but found no results..what i did was used 'write' function to a socket which was binded on to the printer port..any suggesstions..

also whatis the port number generally used for prinetrs..yes it is lpt1..but the number is what i am searching...

huhhh..the last one guyzz..

5.accept() function
this function returns a socket which to interact with a connected client..now i want to know the port to which this socket is bound..is the the one tro which the listener socke is attached..??

i believe thats much for the day..hope to have my doubts clarified soon..!!

thank you for ur patience

rajesh
 
Old 06-18-2004, 07:48 AM   #2
sporadic235
Member
 
Registered: May 2004
Location: Osaka
Distribution: FreeBSD 5.2, Mandrake 9.2
Posts: 39

Rep: Reputation: 15
i will answer some of your questions:

(1) the following will explicitly turn off your machine
Code:
shutdown -h now
(2) you really should make a user account and just issue "su" whenever you need to do some administrative jobs. reason: in case you make something stupid, you won't ruin your system.

(3) sure you can interact with databases using c. but it would be better if you're just using one of those scripting languages like ruby.
 
Old 06-18-2004, 08:10 AM   #3
bashishtha
LQ Newbie
 
Registered: Jun 2004
Location: Baroda
Distribution: Fedora Core 1
Posts: 2

Rep: Reputation: 0
shutdown

1. Use following for shutdown at shell prompt
#shutdown -h now
you can use -h option for halt, -r option for restart. The last option is time of shutdown. NOW indicates immidiate.

You can check other options by following command ( actually for any command help

#shutdown --help
 
Old 06-18-2004, 12:26 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
(3) You can manage databases through C. How you do this depends on what database you're using (MySQL is totally different than Posgres is totally different from Oracle etc.). Consult your database's documentation for more details.

(5) You can find out which port the client is using be analysing the struct sockaddr_in that get filled in when accept returns. I don't think there's any way to get other information about the socket itself. What do you need this info for? The OS handles all the different sockets behind the scenes so you don't need to worry about the exact details. If you're going to get heabvily into this you should purchase volume 1 of Unix Netowrk Programming by W. Richard Stevens.
 
  


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
Queries about KDE... mani_iips Linux - Newbie 1 08-05-2005 03:37 AM
snmp queries alaios Linux - Networking 2 05-16-2005 06:06 AM
***Queries for all of u***** LinuxRam Linux - General 6 08-02-2004 01:09 PM
**Basic Queries**** LinuxRam Linux - Newbie 2 07-31-2004 09:58 PM
I'm a BASIC chap, looking for some info on BASIC programming CragStar Programming 2 01-21-2001 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:34 PM.

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