Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: mini massenger working  (Read 2157 times)

0 Members and 1 Guest are viewing this topic.

hammad khan

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
mini massenger working
« on: September 14, 2013, 09:42:57 am »
i'm working on a massenger and i'm facing the following difficulties

first i'm trying to get the IP of a client computer by the name by the following function

sf::IpAddress ip("computer name");

this function works sometimes, and sometimes it don't work, while the client name is present on the LAN.

and second please elaborate the receive function.
how it works.
and if it don't receive anything than what it'll be return.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: mini massenger working
« Reply #1 on: September 14, 2013, 11:37:32 am »
Quote
and second please elaborate the receive function.
how it works.
and if it don't receive anything than what it'll be return.

This is what documentation is for.  Go read it.

Quote
this function works sometimes, and sometimes it don't work, while the client name is present on the LAN.

According to the documentation for that function, the argument should be "either a decimal address (ex: "192.168.1.56") or a network name (ex: "localhost")."  So I don't think it's meant to take computer names.  I'm pretty sure actual networks don't use computer names anyway; that's what IP addresses are for.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: mini massenger working
« Reply #2 on: September 14, 2013, 12:24:01 pm »
Quote
So I don't think it's meant to take computer names
It takes a host name, which may be different from what you call the "computer name".
Laurent Gomila - SFML developer

hammad khan

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: mini massenger working
« Reply #3 on: September 14, 2013, 08:31:29 pm »
this function also used to get the ip by computer name, and also by host name.