Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP2_Freenet_Go_Socket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeremy.martinot
TP2_Freenet_Go_Socket
Commits
b5ff987b
Commit
b5ff987b
authored
3 years ago
by
jeremy.martinot
Browse files
Options
Downloads
Patches
Plain Diff
Remove client
parent
9016c52d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/client.go
+0
-60
0 additions, 60 deletions
client/client.go
server/server.go
+0
-1
0 additions, 1 deletion
server/server.go
with
0 additions
and
61 deletions
client/client.go
deleted
100644 → 0
+
0
−
60
View file @
9016c52d
package
main
import
(
"encoding/gob"
"fmt"
"net"
"os"
)
type
Message
struct
{
Id
int
Key
int
Type_
string
}
func
createMessage
(
id
int
,
key
int
,
_type
string
)
Message
{
return
Message
{
Id
:
id
,
Key
:
key
,
Type_
:
_type
,
}
}
func
sendMessage
(
address
string
,
port
string
,
msg
Message
)
{
conn
,
err
:=
net
.
Dial
(
"tcp"
,
address
+
":"
+
port
)
if
err
!=
nil
{
fmt
.
Println
(
"Error connecting:"
,
err
.
Error
())
os
.
Exit
(
1
)
}
encoder
:=
gob
.
NewEncoder
(
conn
)
encoder
.
Encode
(
msg
)
rcv
:=
make
([]
byte
,
2048
)
n
,
_
:=
conn
.
Read
(
rcv
)
fmt
.
Println
(
string
(
rcv
[
:
n
]))
conn
.
Close
()
}
func
main
()
{
//reader := bufio.NewReader(os.Stdin)
var
id
=
0
for
{
fmt
.
Println
(
"Quel fichiez recherchez vous ? (ID)"
)
/* input, _ := reader.ReadString('\n')
key, err := strconv.Atoi(input)
if err != nil {
// handle error
fmt.Println(err)
os.Exit(2)
} */
msg
:=
createMessage
(
id
,
19
,
"REQUEST"
)
sendMessage
(
"127.0.0.1"
,
"9000"
,
msg
)
fmt
.
Println
(
msg
)
/* if input == "q" {
os.Exit(0)
} */
}
}
This diff is collapsed.
Click to expand it.
server/server.go
+
0
−
1
View file @
b5ff987b
...
...
@@ -38,7 +38,6 @@ var (
)
func
fillContents
()
{
println
(
"jesuisla"
)
println
(
thisnode
.
MyKey
)
for
_
,
key
:=
range
thisnode
.
MyKey
{
addContent
(
key
,
thisnode
.
Address
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment