[cse491] few questions

Joe Amenta amentajo at msu.edu
Wed Oct 28 19:07:47 PDT 2009


[?]

Additionally, some people may not encounter this problem in the first place:
If your call to sock.bind((host, port)) occurs within the
Server.__init__()method, then you will run into this problem with the
old tests.  Otherwise,
that code will never be run (unless, for some reason, you're binding to the
port in the handle_connection() method, in which case, seek help) and you
will never know the difference.

--Joe A.

On Wed, Oct 28, 2009 at 9:57 PM, Steve Wakeford <wakeford at msu.edu> wrote:

>  Yes it matters because if we forget about just passing the tests for a
> minute, the original implies that you are calling the server class
> constructor with a port (integer) and an app and the second implies a
> hostname (string) and an app. Consistency would be favorable, no?
>
> Note that yes, if I do hard code this as Amenta suggested all of the tests
> pass, thanks to both Joes for assistance.
>
>
> Joseph Blossom wrote:
>
> Does it even really matter? serve_forever is never being called by the
> tests, and therefore the port doesn't really matter at all.  In
> run_fake_socket we can see:
>
> server = webserve_nb.NonblockingServer('', hello_app)
>
> done, data = server.handle_connection(sock)
>
> He's not doing anything over any sort of a network in the tests, but rather creating fake sockets which emulate what a real socket would do. Hence:
>
> class fake_nb_client_sock_obj(fake_client_sock_obj):
>
> Mine does nothing with the port '', and passes the tests fine. I suppose you could for the sake of bad input, but to get your code to work with his tests, nothing extra is needed.
>
> The other Joe
>
>
> On Wed, Oct 28, 2009 at 9:07 PM, Steve Wakeford <wakeford at msu.edu> wrote:
>
>> I am a little stumped as to why the Blocking server is instantiated in the
>> hw7 tests with
>>
>> server = webserve.Server(8000, app)
>>
>> but the Non-blocking server is instantiated with
>>
>> server = webserve_nb.NonblockingServer('', hello_app)
>>
>> Notice the first argument is an integer in the former and a string in the
>> latter. Is it just me or am I missing something? How do we deal with this
>> (for non-blocking) since the port should be dynamically passed in upon
>> instantiation from a command line argument?
>>
>> My goal is to subclass the Blocking server and only to override its
>> __init__() and serve_forever() methods. Any ideas?
>>
>> Thanks,
>> -Steve
>>
>> _______________________________________________
>> cse491-fall-2009 mailing list
>> cse491-fall-2009 at lists.idyll.org
>> http://lists.idyll.org/listinfo/cse491-fall-2009
>>
>
>
> _______________________________________________
> cse491-fall-2009 mailing list
> cse491-fall-2009 at lists.idyll.org
> http://lists.idyll.org/listinfo/cse491-fall-2009
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/cse491-fall-2009/attachments/20091028/91920ac3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 97 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/cse491-fall-2009/attachments/20091028/91920ac3/attachment.gif>


More information about the cse491-fall-2009 mailing list