Sign in to follow this  
Followers 0
olivarra1

TCP connections

10 posts in this topic

i've googled a lot trying to find how to make a c or c++ TCP/IP server in Windows, but i found nothing.

Then thinking and thinking i remembered that Autoit has functions to make TCP connections, and i thought asking here maybe somebody will know.

Now the question: is there any way to make a c++/c TCP server for windows?

thank you very much,

Olivarra1

Share this post


Link to post
Share on other sites



Yes. Look up sockets.

http://msdn.microsoft.com/en-us/library/ms740673%28VS.85%29.aspx

Here's a page to get you started.

Share this post


Link to post
Share on other sites

Yeah, i saw that too, but idk how to get it...

maybe i need Visual C++?

i used to use DevC++ & so

olivarra1

Share this post


Link to post
Share on other sites

It doesn't mater what editor you use. You just need the appropriate header files. If you plan on writing Windows applications, you'll need the Windows SDK. http://msdn.microsoft.com/en-us/windows/bb980924.aspx

This is a set of headers, libraries, and compiler tools for building Windows applications.

If you don't even know this much, you have more to learn about coding in C++ before you try building anything.

Share this post


Link to post
Share on other sites

Or he could just download Visual Studio 2008 Express which ships with the platform sdk (or windows sdk, whatever they call it). Visual Studio is also superior to Dev-Cpp in every possible way.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

I've got a number of programs that load faster than Visual Studio, but most aren't as feature rich.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Oh well, i just have 1 year programming in c++, i learned in university, using linux for making console applications.

I've never done a windowed app., but i don't want to do that. just i want to do a console-like app. (that you run it with cmd).

what i mean:

#include <iostream>
#include <string>
using namespace std;

int main(){
  cout << "hello, how're u?" << endl;
  string response;
  cin >> response;
  return 0;
}

Then including If's, For's, While's, some classes, etc..

and what i want to do it's just a game server, the game is made with Flex + Flash.

Right now i've made the server in PHP, but i wonder if in C++ would be faster and use less memory.

olivarra1

edit: ohh btw, i've found how to include the sockets library. now i just need to see how does it works (functions that it has, etc.)

Edited by olivarra1

Share this post


Link to post
Share on other sites

Yeah, you want to look at network sockets. In particular you want to create a network listener. A quick search turned up this site which talks about setting up a listener in Linux. The Windows implementation is based on the Unix implementation, so most of this should work or at least give you ideas about what you need to do. Also, this site gives a pretty good explanation of what happens during client-server operations and gives some coding tips.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Download the source code for netcat. This should be a good reference for rolling your own prog. But don't directly steal code because A. it's wrong and b. antivirus will flag it for similarities to netcat.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0