Giter Site home page Giter Site logo

garruru / server-c-client-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreaacanfora/server-c-client-java

0.0 1.0 0.0 22.54 MB

c++ Server and Java client with socket

License: GNU General Public License v2.0

C++ 70.14% Java 29.86%

server-c-client-java's Introduction

Server-c-client-java

c++ Server and Java client with socket

Make a chat using the socket server in c ++ and java client. Part client: I created two a text area for messages received one for messages sent and a text field where you can enter the text to send. I enter the user IP address and port of the server, this information I will need to create the socket, and then use the chat I also take the input the user's name, this data is used especially when using the java server that handles multiple users and then you can distinguish by name. Septum title with your name and the current day. Once taken the input data if correct and if the server is running is enabled text field. In case of previous chats will be taken by two rows chat.txt and chat2.txt each one for its text area. The client will have to work before receiving two messages from the server once connected the first is to inform you that it is connected and this will be the string "START_NAME" In fact you can enter the name only after the client has received this message. The second message that will receive '"NameAccepted" this message is used to inform the client that the server has accepted the name. Subsequent messages that will receive the client must be in a format spefico: must contain "Message" before the message if they are messages written by java client instead must contain "messages" before the message if they are messages received from someone else. The client automatically plunder only the post a message or messages. Handled the event sent from the keyboard to send a message and add the sending time of the message also before I post them on file.

The server also acts as a C ++ client and has an interface similar to that of the client java The server is started automatically with the start of the program. Uses port 12345 and is able to communicate with only one client at a time. Wait to connect a client and when that happens enables the buttons to disconnect and to send messages. Unlike the C ++ client does not save messages to a file. Just connects sends two messages to the client java first "START_NAME" and the second "NameAccepted" that serve to make it clear to the client that it is ready. The first message that is receiving full is the name of the client, but unlike message that will receive later this not write it on the text box. A label on the bottom left says the name of the computer connected. A function returns the time and will be added in front of all the messages that are sent, also before each message adds "messages", This serves to make it clear to the java client that the message and 'was sent by the client c ++. As in the java client there are two text boxes, one on the left for messages sent and the right one for messages received. (Only works on windows).

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.