Windows Socket Programming - Need something to connect to.

Started by
27 comments, last by dave 18 years, 8 months ago
Quote:Original post by ace_lovegrove
I don't know, basically with this i havnt much of a clue so any help is great. What do you mean by telnet servers.

ace


Uhhhoohh... You really don't have a clue do you?

Basicly it seems like your understandin on how networking works is a bit, well, let's say limited.

If you want to telnet to your local computer you need to have a server running on it. Else it will be like trying to phone someone who doesn't have a phone noone will answer no matter how hard you try.

So to be able to connect you need to start a server that listens on the port you want to connect to, that's what bind() and listen() functions does but fetch netcat just to get something running and you can start without having to write your own server.

And on the "won't it be occupied already" question, you're specifying the port to connect to not the port you connect from (that will get picked quite randomly by your OS if you don't force it to do otherwise). So no troubles there either.

google for beej's socket tutorial and you should find a decent treatment on socket programing in general.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Advertisement
Quote:Original post by ace_lovegrove
So how do i enable port 23.

ace


You run a server on that port.

You see, you misuse the words. Server opens a port (like 8888 which you wanted to use) and waits for incoming connection from clients. The client sits on random port, which doens't matter really. So, to open a 23 port you have to run a server which opens that port (usually telnetd sits on that port, so you wouldn't use it for your own servers unless you want to get into some troubles)

As previous poster suggested you may look at any socket example.
Actually yeah i get all that but i was first hoping that i could get hyperterminals working in conjunction, but clearly not.


EDIT: oh and every site i found that said they hosted Netcat actually didn't.

ace
Quote:Original post by ace_lovegrove
Actually yeah i get all that but i was first hoping that i could get hyperterminals working in conjunction, but clearly not.

ace


Hyperterminal is used for different tasks, that don't matter to socket programming.
my google karma is better than yours
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
nice work
Quote:Original post by ace_lovegrove
Hi,
Well following a tutorial i have a simple winsock program to test, it connects to a specific port on a specific server. But i have nothing to connect to. Can anyone offer a server or suggestions?
ace


Write a server to recieve on port X
Write a client to recieve on port Y.

Where X!=Y.

Than you can merly connect to your server by using the IP "127.0.0.1".

You can even have a debug switch on both your client and server to switch to G and H, this way you can continue programming and testing your server while other players are playing (Warn them if you think you may crash your computer though, I find they hate it when I don't warn them ;).
Dude.

Read this tutorial. If you have trouble with that, look here.

If you still have trouble, take a deep breath, and read this: Winsock Programmer's FAQ

Each of these is a relatively comprehensive source on the topic.
I have a client server talking to eachother now thankyou all, now i just have to find an SNTP server to connect to and work out what data to send [cry].

ace

This topic is closed to new replies.

Advertisement