Jim's
Tutorials

Spring 2018
course
site

Jim says

The client/server code is fine.

I guess the protocol spec is the text that you have below? I don't think that this is specific enough - if that's what you were given and then asked to write a client/server app, you'd have lots of questions, like "what does 'proper message recieved' mean?".

I think we should have read some RFC's to see what protocol specs looked like.

Nate's Work

Here's a sample test output with the custom server:

>>> python test_server.py
Socket successfully created
socket binded to 12345
socket is listening
what would you like your response to be?
why hello there
uncomfirmed
what would you like your response to be?
hello, let's play a game of blackjack
confirmed
what would you like your response to be?
got some cards for you
uncomfirmed
what would you like your response to be?
you were dealt the king of kinds and the queen of queens
confirmed
what would you like your response to be?
would you like to do some hitting or standing?
stand
what would you like your response to be?
you sure?
h
what would you like your response to be?
oh lets deal another card
s
what would you like your response to be?
sweet - dealer had way too many points - you win!

Here's a sample output from the client side with the non-responsive server:

>>> python client.py
server not responsive, closing connection
Traceback (most recent call last):
  File "client.py", line 27, in <module>
    s.send("uncomfirmed")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 174, in _dummy
    raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor

Here's a sample functioning output with the main server:

>>> python client.py
hello, let's play a game of blackjack
you were dealt the 3 of Diamonds, and Ace of Diamonds, your score is 14
would you like to hit or stand? (h or s)
hit
please print a valid input, (h or s)
h
you were dealt the Jack of Clubs, your score is 24, would you like to hit or stand?
stand
please print a valid input, (h or s)
s
computer busted, player wins
https://cs.marlboro.college /cours /spring2018 /jims_tutorials /web_tech /apr30
last modified Fri December 13 2024 8:27 am

attachments [paper clip]

  last modified size
TXT card.py Fri Dec 13 2024 08:27 am 2.1K
TXT client.py Fri Dec 13 2024 08:27 am 1.1K
TXT deck.py Fri Dec 13 2024 08:27 am 773B
TXT game.py Fri Dec 13 2024 08:27 am 4.3K
TXT hand.py Fri Dec 13 2024 08:27 am 980B
TXT server.py Fri Dec 13 2024 08:27 am 1.4K
TXT server_thread.py Fri Dec 13 2024 08:27 am 748B
TXT test_server.py Fri Dec 13 2024 08:27 am 795B
TXT unresponsive_server.py Fri Dec 13 2024 08:27 am 573B