Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gethostname не всегда работает #48

Open
PoltoS opened this issue Jun 9, 2015 · 4 comments
Open

gethostname не всегда работает #48

PoltoS opened this issue Jun 9, 2015 · 4 comments
Assignees

Comments

@PoltoS
Copy link
Member

PoltoS commented Jun 9, 2015

В модуле Sonos.

Бывает, вижу

[2015-06-09 03:26:52.713] [I] [core] Detected own hostname: 0+
[2015-06-09 03:26:52.713] [I] [core] Detected own hostname: p+
[2015-06-09 03:26:52.713] [I] [core] Detected own hostname: �+

вместо

[2015-06-09 11:36:27.157] [I] [core] Detected own hostname: 192.168.0.184
[2015-06-09 11:36:27.157] [I] [core] Detected own hostname: 192.168.0.184
[2015-06-09 11:36:27.157] [I] [core] Detected own hostname: 192.168.0.184

Такой бред явно толкьо из C++ может появиться.

Код такой:

   var sockHost = new sockets.tcp();
    sockHost.onclose = function (remoteHost, remotePort, localHost, localPort) {
        if (localHost) {
            console.log("Detected own hostname:", localHost);
            self.hostnames[household] = localHost;   
        }
    };
    sockHost.onconnect = function(remoteHost, remotePort, localHost, localPort) {
        this.close();   
    };
    sockHost.connect(host, 1400);
@PoltoS
Copy link
Member Author

PoltoS commented Aug 26, 2015

done

@PoltoS PoltoS closed this as completed Aug 26, 2015
@PoltoS
Copy link
Member Author

PoltoS commented Oct 25, 2015

Все ещё не работает:

(gdb) print m_connection->m_myaddress.in.sin_addr
$8 = {s_addr = 0}
(gdb) print buffer2
$9 = "0\276\033\350\377\177\000\000\060m\246\355\377\177\000\000H\301\033\350\377\177\000\000\000\000\000\000\000\000\000\000\360l\246\355\377\177\000\000\016^\232\367\377\177\000\000P\233\032\350\377\177\000\000\060m\246\355\377\177\000"
(gdb) print m_connection->m_myaddress.in.sin_family
$14 = 0

@PoltoS PoltoS reopened this Oct 25, 2015
@PoltoS
Copy link
Member Author

PoltoS commented Dec 6, 2015

Опять проблема:
[2015-12-07 01:36:16.290] [I] [core] Detected own hostname: @7��X�
(модуль Sonos)

@PoltoS
Copy link
Member Author

PoltoS commented Dec 7, 2015

Похоже, в onclose() callback уже сам сокет закрыт и нет более информации о m_myhostname.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants