Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CanguruChatServer
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
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fernando Erd
CanguruChatServer
Commits
f6ba8655
Commit
f6ba8655
authored
8 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Test with queues
parent
f36a01e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Canguru/CanguruChat.py
+8
-1
8 additions, 1 deletion
Canguru/CanguruChat.py
with
8 additions
and
1 deletion
Canguru/CanguruChat.py
+
8
−
1
View file @
f6ba8655
...
@@ -30,6 +30,7 @@ import socket
...
@@ -30,6 +30,7 @@ import socket
import
threading
import
threading
import
sys
import
sys
import
binascii
import
binascii
import
Queue
HOST
=
"
127.0.0.1
"
# Endereco IP do Servidor
HOST
=
"
127.0.0.1
"
# Endereco IP do Servidor
SEND_PORT
=
5000
# Porta que o Servidor envia
SEND_PORT
=
5000
# Porta que o Servidor envia
...
@@ -103,14 +104,16 @@ def client ():
...
@@ -103,14 +104,16 @@ def client ():
dest
=
(
HOST
,
SEND_PORT
)
dest
=
(
HOST
,
SEND_PORT
)
print
'
Para sair digite exit
\n
'
print
'
Para sair digite exit
\n
'
protocolMessage
=
Protocol
()
protocolMessage
=
Protocol
()
queueMessage
=
Queue
.
PriorityQueue
()
protocolMessage
.
setDestiny
()
protocolMessage
.
setDestiny
()
protocolMessage
.
setPriority
()
protocolMessage
.
setPriority
()
protocolMessage
.
setMessage
()
protocolMessage
.
setMessage
()
protocolMessage
.
setSizeof
()
protocolMessage
.
setSizeof
()
protocolMessage
.
setCRC32
()
protocolMessage
.
setCRC32
()
msg
=
protocolMessage
.
getEmpacotar
()
msg
=
protocolMessage
.
getEmpacotar
()
queueMessage
.
put
((
int
(
protocolMessage
.
priority
),
msg
))
while
protocolMessage
.
msg
<>
'
exit
'
:
while
protocolMessage
.
msg
<>
'
exit
'
:
udp
.
sendto
(
msg
,
dest
)
#
udp.sendto (msg, dest)
protocolMessage
=
Protocol
()
protocolMessage
=
Protocol
()
protocolMessage
.
setDestiny
()
protocolMessage
.
setDestiny
()
protocolMessage
.
setPriority
()
protocolMessage
.
setPriority
()
...
@@ -118,6 +121,10 @@ def client ():
...
@@ -118,6 +121,10 @@ def client ():
protocolMessage
.
setSizeof
()
protocolMessage
.
setSizeof
()
protocolMessage
.
setCRC32
()
protocolMessage
.
setCRC32
()
msg
=
protocolMessage
.
getEmpacotar
()
msg
=
protocolMessage
.
getEmpacotar
()
queueMessage
.
put
((
int
(
protocolMessage
.
priority
),
msg
))
print
queueMessage
.
get
()
print
queueMessage
.
get
()
print
queueMessage
.
get
()
threadServer
.
_Thread__stop
()
threadServer
.
_Thread__stop
()
udp
.
close
()
udp
.
close
()
...
...
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