Results 1 to 3 of 3

Thread: Sending Message From One TCPSocket to Another

  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Sending Message From One TCPSocket to Another

    Hi all,

    I have written a simple network program that includes a server and two clients. What I want to do is to establish a connection between those clients.

    When I send information from the server to the clients it works OK. But if I try the kind of same thing in a reverse order(from one of the clients to the another client), it doesn't work.

    I'm quite fresh in network programming so I couldn't even be sure if I design the correct architecture for the clients to communicate. I mean maybe just two TCPSockets are enough to achieve..Anyways any suggestions could be profoundly helpfull.

    King Regards

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sending Message From One TCPSocket to Another

    It kind of depends what you want to achieve.
    Direct connection: Clients have to ask server about other client, you can then setup the connection (p2p)
    Indirect connection: Clients send to server, server relays to other clients based on some addressing or grouping (irc, icq, msn)

    If you want the server out of the equation, the two clients should be able to auto-detect each others presence (you could use a broadcast message at a certain port or use the apple bonjour framework for that, just to name two possibilities). You could of course also just enter an ip address or host name. There are some Qt examples for this type of communication.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Sending Message From One TCPSocket to Another

    Hi again,

    The indirect connection is the thing then. But the problem is I can't send any to server for other client to take it..I will check the documentation and inform you if a problem rises.


    Added after 40 minutes:


    Hi,

    I have looked and applied some of things written in the docs but it didn't work anyway. As far as I surf in the web, it's a common problem for developers to send data from client to server.
    Last edited by zgulser; 30th November 2010 at 07:54.

Similar Threads

  1. TCPSocket/Server
    By TheGrimace in forum Qt Programming
    Replies: 20
    Last Post: 31st August 2009, 22:38
  2. TcpSocket encrypted() signal
    By eleanor in forum Qt Programming
    Replies: 0
    Last Post: 23rd April 2009, 06:44
  3. how to operate tcpsocket in thread again
    By succulent_lily in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2008, 05:57
  4. Replies: 4
    Last Post: 12th October 2008, 13:47
  5. QProcess+TcpSocket
    By Fastman in forum Qt Programming
    Replies: 14
    Last Post: 13th November 2007, 11:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.