Recent

Author Topic: Client > Server > Client  (Read 9757 times)

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Client > Server > Client
« on: October 05, 2010, 07:36:40 pm »
Hallo, fellow Lazarusers.
I wish to write a program for educational purposes. It's a 1 to 1 chatroom, and is designed to:
  • Have a copy of the program on both computers that would like to communicate. (Mine and a friends)
  • Be able to send simple text via the Internet and recieve it on the other computer
The problem is, the original design of the program was that the server program was on my computer, and a client on another. But I need to set up port forwarding on my router to have them connect, and I'd rather not do that.
I was wondering if there was a way I could
  • The person operating the first client program would type in a string and hit 'send'.
  • The client program sends the string to the server (Not hosted by me, maybe a website designed just for this?)
  • The server then sends the same string to the other client, 'forwarding' it. The client recieves it and prints it out on the screen.
I think this is how most chatting programs work, such as MSN messenger.
The question is, is there a free server out there that does what I request?
If so, please explain to me how to use it.
Thanks, Jishaxe.
« Last Edit: October 05, 2010, 07:48:48 pm by Jishaxe »
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Client > Server > Client
« Reply #1 on: October 06, 2010, 10:12:23 am »
IMHO there cannot be such a generic server. Your task can be done by "net send" on Windows and "smbclient" (or many other) on Linux. Each client runs its own service - and that's the way you could start to code. Run a server that listens at a specific port and handle messages, sent by a client to this port, like you want. BTW: be aware of open ports, firewalls, routers, virus scanner etc. A good starting point to network programming is Ararat's homepage (author of Synapse).
Lazarus 1.7 (SVN) FPC 3.0.0

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: Client > Server > Client
« Reply #2 on: October 06, 2010, 05:57:04 pm »
Thanks for answering.
The programming part of it I know, I've written a server/client program before and ran them both on localhost.
They worked.
My problem is I do not want to configure my router to forward data to my computer to make it a server, I was wondering if there was a way around it.
Thanks, Jishaxe.
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Client > Server > Client
« Reply #3 on: October 07, 2010, 09:22:22 am »
You could use port 80 (http) or 21 (ftp). Or connect to any server that hosts a file or a database that is (ab)used for your chat messages. Sounds like a simple task in PHP  8)
Lazarus 1.7 (SVN) FPC 3.0.0

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: Client > Server > Client
« Reply #4 on: October 07, 2010, 05:06:52 pm »
So by using port 80 a client program can connect to the server program via the Internet?
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

mvampire

  • Jr. Member
  • **
  • Posts: 62
Re: Client > Server > Client
« Reply #5 on: October 08, 2010, 09:17:49 am »
As I understood, Your problem is NAT+port forwarding, not any kind of programming problem or Lazarus problem.
You will need router setup anyway if You have NAT. That's how Internet works now...

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: Client > Server > Client
« Reply #6 on: October 08, 2010, 04:24:50 pm »
So there is absolutely no way to do this without port forwarding?
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: Client > Server > Client
« Reply #7 on: October 08, 2010, 04:30:54 pm »
using port 443 would go through any firewall, but requires a SSL communication
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

 

TinyPortal © 2005-2018