Okay now you have seen how we contend that our own network in a way in simpler times.
But as you may have noticed that this method of sending that I had several problems the one of the main
problem is that you can only send a very rudimentary fundamental labor data.
For example if you want to write the string that has two lines you cannot do that because whenever you
press enter the record will stop taking for that input and it will send whatever was returned to the
function.
Now what we can do is that we can defend and read turns up.
Overcoming this problem because this is a very common problem in networking for example how to send
data.
So there are solutions like serialization and coding et cetera.
So what we want to do is that in this case we will focus on sending a start of what a network.
So what do you will do is that we will define a start in server side.
And then we will try to send this stuff back as a whole or at the network to the clients I try.
Example Let's say we have a fire for example.
It says Hi how are you.
And then we have a new line called I am good.
So as you can see that this cannot be sent over our conventional method that we started earlier.
So if we say hi how are you.
What will happen is that it will start taking input at this point and then this I am good will not be
taken since it encounters a new line character here.
So this means that it can only take a very rudimentary type of data for example string and you cannot
send other type of inputs for example in integers frauds or balls whatever you want to send.
And also you cannot send files using this method.
This problem can be overcome with using a glob package.
So Gob was developed by Gord Lang to overcome this problem of sending data structures over a network.
Uh communication.
So what happens is that there are different ways for example every language has its own way of sending
it.
You can send it to using exemplified using Jace on our portable buffers but I'm going to focus on this
go up encoding.
So this glob is a special type of encoding and you can read about it here
so you can do the whole gobs of data.
And it defines the way we need calls to send out over the network how we tries to send it.
Mm hmm.
So it does.
So it gives us an example.
For example how to send it.
Uh we will do this example No.
Then you will be able to understand how to send it.
So the first thing we need to do is we need to define a struct and then whatever data you want to send.
We will define the word data inside the struct and then we will go to the whole struct and then tried
to send this drug to over a network for example that start writing and then type and let us name the.
For example that scarlet letter struct and then we will define types for example.
Let's say I want to send my name.
Which would we have a string.
And then I want to send my I.D. which would be a fight in teacher.
Similarly I can send other types.
For example my age let's say it's flawed as you can see that this data is quite complicated data and
it can also contains custom types.
For example if I create my own dataset and then try to send this data structure I can also define it
here and then I can send this whole data set out in one go.
And I don't have to worry about anything so let's say stick with the two fields just one now.
So now you have a start.
The nice thing we need to do is we need to fill in the details of this drug.
So what I'm going to do is
I'm going to remove this thing one thing.
So now we have to fill in the details of this talk let's say.
The first thing I will do is I will set the values for these elements
so what I have to do is I have to create a struct equals two and then I will give a reference to this
struct which is data.
The next thing is I need to define the values.
So I'm going to define name as John's made and you can see that this can contain multiple values.
For example if you want to write backslash and here and then I write something like a chance made John
Doe.
So let's say he somehow has a name that contains a new line character.
It doesn't make sense but I'm just given an example and then he has an idea or let's say 50 and then
age let's see if the poem T for 40 years or whatever it is.
So now we have our data structure and we can know we have to send this data structure over our network.
So what we can do is we can use cob and new encoder since we want to send it from our server to the
client.
We have to first encode this data into the call.
So I'm going to use the new encoder and then what connection we want to use.
All right.
So since our IP in this case will be our connection that is the connection of the channel that we want
to use to send out right now.
Once we have that we have to associate with this.
We have to encode this.
So let's talk this and then and Coda.
So now you have an encoder that sense that are using this link.
The next step is to encode this data or this data struct.
So I am going to use encoder dot loops dot and code method.
So this my third whatever data structure we give this and court this data structure and then at the
same time it sends that data over this connection and you don't have to write by example and quarter
or send that data or something.
So whenever you call in code it automatically and course the data and at the same time it sends that
data over to the network.
So I'm going to use the data here.
Okay.
And then they do tons and edit if it's unable to send data
then we can simply handle this.
And long is that that is sent properly.
It's done is added as we can just find out that the data has been sent successfully.
So this is the server side of how you send it.
What's the issue here.
Okay
so that's it.
That's how you encode your data and send it over a connection.
So in next election we will define same load procedure and then we will try to decode this data on our
victim site.