Giter VIP home page Giter VIP logo

chat's People

Contributors

devfoo-one avatar

Watchers

 avatar  avatar

Forkers

devfoo-one

chat's Issues

use of undeclared identifier 'gethostname'; did you mean 'gethostbyname2'?|

Platform: OS X 10.9.5
Server/main.cpp:43

i just wanted to test my client against your server but codeblocks tells me this... and now i´m sad.

-------------- Build: Debug in Server (compiler: GNU GCC Compiler)---------------

g++ -std=c++11 -Wall -g  -c /Users/tom/Documents/Dev/max/chat/Server/main.cpp -o obj/Debug/Server/main.o
/Users/tom/Documents/Dev/max/chat/Server/main.cpp:43:9: error: use of undeclared identifier 'gethostname'; did you mean 'gethostbyname2'?
    if (gethostname(hostname, sizeof(hostname)) == -1) {
        ^~~~~~~~~~~
        gethostbyname2
/usr/include/netdb.h:292:17: note: 'gethostbyname2' declared here
struct hostent  *gethostbyname2(const char *, int);
                 ^
/Users/tom/Documents/Dev/max/chat/Server/main.cpp:43:49: error: comparison between pointer and integer ('struct hostent *' and 'int')
    if (gethostname(hostname, sizeof(hostname)) == -1) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
2 errors generated.
Process terminated with status 1 (0 minute(s), 1 second(s))
2 error(s), 0 warning(s) (0 minute(s), 1 second(s))

||=== Build: Debug in Server (compiler: GNU GCC Compiler) ===|
/Users/tom/Documents/Dev/max/chat/Server/main.cpp|43|error: use of undeclared identifier 'gethostname'; did you mean 'gethostbyname2'?|
/usr/include/netdb.h|292|note: 'gethostbyname2' declared here|
/Users/tom/Documents/Dev/max/chat/Server/main.cpp|43|error: comparison between pointer and integer ('struct hostent *' and 'int')|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

TODO Erste Rücksprache

  • 1. Use getaddrinfo() (apparently you can pass it an hostname or a IP) (see here)
  • 2. Investigate if struct has the same memory layout as a byte array (if not copy data to the byte array directly)
  • 3. See if there is a function to test whether there is new input (unblocking)
  • 4. Our message is 152 bytes long. Should be 150 though. Maybe this is related to 2.
  • 5. Make the IP configurable at runtime.
  • 6. Server should display its IP. #2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.