Hello and welcome to the Go programming language course in the previous session.
We were able to implement to run G.P.S. server function, and in this session we want to implement the
range your PC client function.
The client must communicate with the server to do this.
We use the dial function of the G.R. PC package during our function.
Create a client connection to the given target.
This function accepts two parameters first, that address a target, and second is lists of denial option
and return to values first and object from client connection.
And second, an error object.
So first, go to run your PC client and define to Maribeth Light Connection, and it will connection
and calling you calls calling down function from C Typekit your PC dot the off
set address
127.0.0.1 column.
Eighty eighty five as port.
And for dialogue option in this case, for use with insecure function from GOPAC package that returns
a deal option which disable transport security for this client connection g r p c dot we'd.
In sexual function.
OK.
First check and order status.
If it were not equals need.
Not the photog thought, you know, using this Earth for close connection after functions completed
the ether connection to close.
Now it's time to start line service.
We do this by calling the new Student Service Client Method from protocol package.
This method receives a connection as an input parameter and returns a client service, a student of
the portal to us.
So first, define a variable like client client column equals and calling you a student service client
from Protocol Protocol, Dot, new student service, client function and Cert connection as parameter
connection.
The client is now connected to the server and we can call the methods in our job is the service.
First, we display a few messages that indicate what the client wants from the server, so we write
off P
and back list.
Welcome.
Please enter number to select your requests, go to the next line and set number one message.
FP.
One select oh, students
based nay and go to the next line and set number two message
FP
to call column select, add this to there based on the know
and set a message for select number by the user.
If.
The.
Barack is less and.
Please enter your No.
Now define evaluated for store value that receive from client by the scandal and function.
So we try, for the example, improved quality calls and go to the next line calling Escandon function
from family package if and to on the scan and in function ampersand input.
Suppose that clients select no one saw me write a statement for selecting no one messes for this purpose
because an equal fall from a strings package that reports whether twisting parameters interpreted as
UTF eight strings are equal on their unique case for you, which is a more general form of chaste insensitivity.
So be right if it swings.
Guts, equal form and sit in pool and perimeter.
One.
Define a variable for store name value column equals double quotation mark if in two thirds print into
your name.
And receive name value by calling can information from client if you got a skin alarm function and ampersand
and the venue now set a new line.
Now it's time to call and get the students by name method from pro to fine so we can get the students
by name method from client object.
The past two arguments for this method.
First, a context and second an object from search by name, message and return stream of students and
or object.
So define two variables like a this and we'll call it equals client to give the students by name calling
background function from context as a context, argument, context, dark background
and create an instance of search by name is derived from protocol package and initialized name value
for it as second arguments.
Arguments for the example ampersand protocol
dot search by name and set for name value.
Name equals.
Value reform at the cold and save the project, go to the next line.
First, check your status, if at all not equals mean, like that fatal error of DOT.
So we create the full loop and this loop will be able to receive data as long as it is sent from the
data server.
So create for.
We received data from server by the receive function first, create two variables like student and error
calling equals the student's
dot c function.
Now we want to check and see if the data is still sent to us from the server or not.
For this purpose, be used in the file from IE or package.
So we write Eve all equals equals AI or DOT.
And often
if the program enters this block, the break command is executed reg
and check it or a status Heathrow.
Lord, the faithful and all that.
Oh, and now preen the student value FP.
Students.
And set a new line for display better WiFi
and set return.
OK, reform of the code and save the project.
Now, if the client does not select number one, the program will not enter the FBI much and will run
from here on or in other wars.
Number two has been selected, so create a message for entering I.D. value.
If A. Don't print an instant message, enter your I.D., Colin, go to the next line, receive I.D.
value by calling is information from clients, so be right if indeed all this content and said Anderson.
Input value I and we create a new line for better display.
That's
OK.
Then we receive the parameter from the console.
This parameter into the program, as is string type and in this case, because the type of I.D. is integer
and on the other hand, the receive parameter is of type S3.
So it is necessary to convert the receipt parameter to INT value for this purpose, calling 80 only
function from SDR conf package for chest being input a string variable to an integer value so defined
to variable like I.D. and or I.D. comma there column he calls and calling a toy function from SDR card
package is still called and said import labor.
OK.
Take every status.
Like the FATTORE.
And sit erode the art or function.
OK, now it's time to call and get a student, buy the metal from putrefying so we can get the student
by either method.
Front line object the past two arguments for this method first context and second and object from search
by either Mercedes and return a student and or object so defined to marry bill like this student and
or a student.
Come on, little Collins equals and con and get a student by IED function from Client Client Dot.
Get a student by IED, cutting back on function from context as context, argument, civil right context,
dot background function and create an instance of service by name ideas derived from protocol, package
and initialize.
I value for it as second hour units sold right.
Anderson.
First of all, dot search by IED and sit IED venue for it by testing to N64, IED, IED and cast and
sixty.
Now check our status if you learn the battle and sit around and display their student value.
FP a student.
And we create a new life or better display if we OK now we were able to implement run GOPAC client function
in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.