Operating System - HP-UX
1834462 Members
2615 Online
110067 Solutions
New Discussion

Langugae C - connecting to a server

 
Piotr Kirklewski
Super Advisor

Langugae C - connecting to a server

Hi there
I'm learning C and was reading several tutorials but they are useless.

I need to learn how to build a simple program which will connect to a Linux server.
That's it.

Please advice

Jesus is the King
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Langugae C - connecting to a server

Shalom,

What type of connection. FTP, SFTP, SSH. The connection type matters.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: Langugae C - connecting to a server

Hi:

Then Google is your friend. There's a number of good examples of C socket programs on Linux using the 'gcc' compiler. Google "C socket example" to find:

http://www.linuxhowtos.org/C_C++/socket.htm

Regards!

...JRF...

Piotr Kirklewski
Super Advisor

Re: Langugae C - connecting to a server

SSH would be nice.
Thanks

Jesus is the King
Steven Schweda
Honored Contributor

Re: Langugae C - connecting to a server

> SSH would be nice.

I doubt that you know what you're asking,
but:

http://www.openssh.com/

> What type of connection. FTP, SFTP, SSH.
> The connection type matters.

Yes, and there are many more types than
these few.

Are you trying to write two programs which
talk to each other, or one program which
talks to an existing (standard) server? If
the latter, a program like wget might be an
example which is only moderately complex.
Piotr Kirklewski
Super Advisor

Re: Langugae C - connecting to a server

My question though was more about how to start:

How do I create a socket + connect to a port on some server.

The program doesn't have to do anything besides that at this moment.

Regards

Peter
Jesus is the King
James R. Ferguson
Acclaimed Contributor

Re: Langugae C - connecting to a server

Hi (again):

> My question though was more about how to start: How do I create a socket + connect to a port on some server.

And the link I cited above would begin to enlighten you. It is even Linux oriented --- another clause you used in this post.

Regards!

...JRF...
ranganath ramachandra
Esteemed Contributor

Re: Langugae C - connecting to a server

you can start with one of the many tutorials, available on the internet, for "unix network programming" or "socket programming". here is one such:

http://beej.us/guide/bgnet/

also richard w. stevens' books "advanced programming in the unix environment" and "unix network programming".
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo