![]() |
|
#1
|
|||
|
|||
Couple of Socket QuestionsI am currently working on some socket programming, created a few programs but here is my question.
Info: Creating telnet server, attempting to add in client functions via the System(function) command 1) Is there a way to take a system function and send the results to the client, i.e. the result of 'ps -aux' or 'tasklist' and send it to the client, i can currently have it first create a temporary file, then read the file to the client, is there a better way? 2) Does anyone have a link to a tutorial on unix/linux file sending programming? I cannot seem to find anything, unless I want to do with Windows. I take it isnt as easy as send(int, file, bitsize, int) Thx for everything |
|
#2
|
|||
|
|||
Re: Couple of Socket QuestionsQuote:
You might consider using a pipe. Here is an example that should work for Linux (gcc compiler): CPP / C++ / C Code:
Here's the text file that I used: Code:
Here's the output on my Fedora Core 5 platform: Code:
Note that prototypes for popen() and pclose() are found in the GNU header <stdio.h>, and the functions are linked into my program automatically with the rest of the standard library, but the functions themselves are not part of the C (or C++) standard libraries. Borland and Microsoft Windows compiler users can try pipes with _popen() and _pclose() instead of popen() and pclose(). Quote:
If by "file sending" you mean network programming (sockets programming), the answer is, "Yes, and it's a good one!" Beej's Guide Regards, Dave |
|
#3
|
|||
|
|||
Re: Couple of Socket QuestionsThank you for the very detailed help! It helped a lot and the link was awesome, thank you.
|
Recent GIDBlog
Stupid Management Policies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [PROGRAM] Winsock Programming | Max Payne | MS Visual C++ / MFC Forum | 1 | 09-Mar-2007 00:38 |
| Socket Programming questions | Radi0ShacK | C++ Forum | 4 | 14-Feb-2006 12:02 |
| A couple questions about Fl_Tabs | WW. | FLTK Forum | 3 | 07-Oct-2004 08:04 |
| Couple of questions Memory and CD RW | schuumi | Computer Hardware Forum | 3 | 15-Sep-2004 16:32 |
| Multi-Lingual Webpages & A Couple General Questions. | dwaunthomas | Web Design Forum | 5 | 15-May-2004 12:07 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The