Hey all,
So, I'm knocking together a Chat program for some friends & me. Yes I KNOW there are a brazillion or more Chat APPs out there, but I want to make one. So there. XP
Anyway, let's say a friend & I are both online with our programs running. My IP is, say, 111.111.111.111, and my friend's is 222.222.222.222. My friend, however, is in the next town/county/state, so is no part of my LAN. Now, let's say we both have TCP servers created & running for our Chat programs, like:
Me-
Friend-
Both our programs are listening for messages from the other, with some code like:
Then, my program sends a TCP stream to my friend's APP (still listening,) with something like:
Assuming my friend's APP is still listening, would this code work, and the message be recieved? Or would I have to use UDP, or some other method altogether?
So, I'm knocking together a Chat program for some friends & me. Yes I KNOW there are a brazillion or more Chat APPs out there, but I want to make one. So there. XP
Anyway, let's say a friend & I are both online with our programs running. My IP is, say, 111.111.111.111, and my friend's is 222.222.222.222. My friend, however, is in the next town/county/state, so is no part of my LAN. Now, let's say we both have TCP servers created & running for our Chat programs, like:
Me-
ServerPort = 1234567 ChatServer = CreateTCPServer(ServerPort)
Friend-
ServerPort = 7654321 ChatServer = CreateTCPServer(ServerPort)
Both our programs are listening for messages from the other, with some code like:
Repeat InStream = AcceptTCPStream(ChatServer) Until InStream
Then, my program sends a TCP stream to my friend's APP (still listening,) with something like:
OutStream = OpenTCPStream("222.222.222.222",7654321) If OutStream WriteString OutStream,"Ahoy!" WriteString OutStream,"Anyone out there?" CloseTCPStream(OutStream) EndIf
Assuming my friend's APP is still listening, would this code work, and the message be recieved? Or would I have to use UDP, or some other method altogether?