Hello and welcome to the Golang programming language course.
In the previous session, we could define the flag and sutures between returned values and indecision.
We want to implement the wrong client function.
So go to the right line function and implement speech.
First, we create an object from the person political buffer and initialize it.
For example, we define a variable like person.
Color equals protocol.
There are.
Kirsten,
now initialize it's Phil's idea, I.D., for example, Wong and me, for example, came and age, for
example.
Twenty five.
Now we use the martial function from protocol package to sterilize our political power data and install
it in the data available, which we display.
This will print our encoded data.
This function accept a portal message object as input parameter and return to values.
First, a slice of pie and second an error value.
So define two variable like data and it will.
Data coming, you column he calls Protocol Dot, Marshall said person as a portal message, Anderson.
Person.
And check the status.
Lock the throttle and set a message for a more shrugging.
Her off.
Now we want to send the creative data to the server.
This data must be transferred to a port on the server that the server can read data from that port.
So we designed the function can't send data that information can be sent to a specific port inside it
to do this.
We use the TCP port protocol saw first create a function name saying data.
Fine sand date
that accept a binary as input parameter data point.
OK.
Now calling dial function from Nets package, the other function connects to the address on the named
network.
This function accepts two parameters as network and address by the type history and returns to values
as a connection, and it so define tool variable like connection and error
tolerant equals and calling dial function from that package.
NAT data
for network reset TCP
and set addresses for TCT networks.
The address has the four host ports.
The host must be a neutral IP address or a host name that can be resolved to IP addresses.
The port must be a literal port number or a service name, so we write 827 Dot zero dot zero thought
one column and set port, for example 885.
Now check error settings.
Sit a Mrs.
For example, connection at all.
Now calling DFA for close in connection after function is completed, Ether Nation Dot closed.
Now why?
Calling the right function the right, the information into the connection connection dot right and
set data brighter day to now go back to the front line function and send the data to the server by calling
the send data function.
Send data and set data has argues data.
So far, you have been able to receive data from the client and sent into the server by designing two
functions RON client and send data in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.