4 Replies - 892 Views - Last Post: 19 October 2008 - 04:11 AM Rate Topic: -----

#1 Sonastylol  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 151
  • Joined: 15-December 07

C++ Application that connects to a server?

Posted 17 October 2008 - 05:41 PM

Hey,

I hope my question isn't too obscure so I'll try to explain it. Basically, I've been learning C++ rapidly due to school and also outside-class exploration and reading/practicing.

I am able to make a C++ application that (obviously) runs as a standalone .exe and can do..you know...whatever I ask it to do.

My question is:

Let's pretend we create a .exe c++ application that has a menu.

1. Login
2. Quit

If we enter 1, and it runs the code under the optioncase "1", is it possible for this program to somehow connect to a server? or database?

I don't technically understand what exactly a server is, so let's say a MySQL database. Is it possible to connect to a database just as a PHP page would? I know very well how to connect to a database with PHP/MySQL but I would love to be able to have a C++ application that allows for connectivity and then displays "Connected".

Even just CONNECTING and having output say "CONNECTED" would make me SO excited!! That is like the BASIC functionality of ANY online game or program.

Is This A Good Question/Topic? 0
  • +

Replies To: C++ Application that connects to a server?

#2 UG Cyber  Icon User is offline

  • D.I.C Addict

Reputation: 32
  • View blog
  • Posts: 546
  • Joined: 24-July 08

Re: C++ Application that connects to a server?

Posted 17 October 2008 - 06:32 PM

Yes!! Actually i am having a problem with my Server/Client. but i can't post that here :D

It is called winsock. It is hard to learn, but once you get it, it's easy.
Was This Post Helpful? 0
  • +
  • -

#3 Sonastylol  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 151
  • Joined: 15-December 07

Re: C++ Application that connects to a server?

Posted 17 October 2008 - 09:57 PM

View PostUG Cyber, on 17 Oct, 2008 - 06:32 PM, said:

Yes!! Actually i am having a problem with my Server/Client. but i can't post that here :D

It is called winsock. It is hard to learn, but once you get it, it's easy.



Oh if you could give me any tips that would be great.

I'll have to lookup some tutorials on C++ winsock.
Was This Post Helpful? 0
  • +
  • -

#4 UG Cyber  Icon User is offline

  • D.I.C Addict

Reputation: 32
  • View blog
  • Posts: 546
  • Joined: 24-July 08

Re: C++ Application that connects to a server?

Posted 18 October 2008 - 12:41 PM

It is a good idea to use multi threading when you are making a client or server. because when you use the 'listen()' function or the 'recv()' function, your program will not respond to anything untill it gets a client or a message. Multi-Threading will prevent this and allow you to send while listening for a client or waiting for a reply.

Good luck
Was This Post Helpful? 0
  • +
  • -

#5 homemade-jam  Icon User is offline

  • Gabe's Nemesis
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,300
  • Joined: 17-March 08

Re: C++ Application that connects to a server?

Posted 19 October 2008 - 04:11 AM

It takes a very long time to become fluent with winsock, however if you take a look at the example on the MSDN , to make do what you want just set the correct ports and code in the commands that you would normally give as if you were telnetting into the sql server (for exampe), if you want to download the html you have to connect to it as if you were a browser, a quick google will tell you all you need to know.

Does that start you off?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1