Re: C and Network
- From: Doug <DougTheScot@xxxxxxxxxxxxxx>
- Date: Mon, 13 Aug 2007 12:39:05 -0700
On Aug 13, 8:10 pm, Aleramo <monferrato2...@xxxxxxxx> wrote:
I want to know if it's possible writing in the C-Language a program
1) identify the servers and computers in a local network, and knowing
the computers i could access with my identity;
2) give me the possibility to choose one computer i can access, to
have the list of directories and files on C (for Windows) or in the
Home (for Linux).
I hope it's possible writing it with some functions in a library,
because i like C and i don't want to change it with another language.
Bye bye Marco.
You'll soon be receiving lots of "we can't help you here" responses.
Sorry about that. You can indeed do what you require in C, though not
standard C. So I'm supposed to point you to other newsgroups where
you can ask more directed questions.
I'll try to give you some pointers, though. I won't bother pointing
out other newsgroups directly - I'm sure you can find them easily
enough. If you can write C, which it sounds like you can, then that
won't be a problem.
If this is a fun, personal, project, then I'd do this with a server-
client type approach. You'll need to use some non-standard-C stuff to
get the job done:
- you'll want a client and a server process. For communication over a
typical network you'll need to know about "sockets". Google and read
up on it over several cases of beer; expect it to take a while.
You'll also need this for your network discovery - finding the other
machines you care about.
- on the servers, you'll need to know how to access the local
filesystem. Google readdir, I'm sure it'll point you to the
equivalents on other platforms
- try and write the code so that the pieces involved in the above are
isolated and can be easily substituted depending on your OS. This
will give you some element of portability.
If this is not for fun, if you just need to get something running:
- if it doesn't need to be homegrown, maybe samba would work for the
platforms you care about. There are other platform specific utilities
(like network shares on windows) that can do the job. At the client
end, the details could be hidden behind a simple CLI script.
- on some OSes (windows is the only one I know about for sure) there
are calls I believe you can make to ask the remote computer to tell
you what you want to know. I'm afraid I don't know much about it,
though. Newsgroups might help here.
Again, this is all very OT here. I'm going to duck now.
Hope that helps,
- C and Network
- From: Aleramo
- C and Network
- Prev by Date: Re: top post
- Next by Date: Re: 'Int' is faster than 'Char'
- Previous by thread: Re: C and Network
- Next by thread: Re: C and Network