Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

github.com/suraj-25/chatbox

Package Overview
Dependencies
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/suraj-25/chatbox

Source
Go Modules
Version
v0.0.0-20210305191208-7e8cd5c27f23
Version published
Created
Source

ChatBox

RPC based application where the client can directly send msg to server and vice-versa.

We are here implementing a simple application based on Golang in which Server and the Client can connect with each other and can exchange information with each other, this exchange of information is a two way.

  • First of all, we need to create a Golang server: -
  • To create the Golang server we will use Server.go file.
  • Here we define main() function in which we print some information and in the next line we use net.listen() which will start our go server.
  • We also defined the write and read operation so that it can read the data from the client.
  • We also defined the Go routine which will listen to the client response and run concurrently.
  • The full code for Server.go file which will run our Go server is given below: -

image

image

We need to create a Golang Client: - 1.To create a Golang Client we use Client.go file. 2. Here we define the main() function in which we define the net.conn() which will setup the connection with our Go Server for the sake of the communication. 3. We also defined the read and write operations here so that it can read the data from the server side. 4. The full code of Client.go file which will interact with our Go server for further communication ids given below: -

image

image

EXECUTION: -

image

image

image

image

############## THANK YOU ###################

FAQs

Package last updated on 05 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts