Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php on line 28 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php on line 33 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php on line 34 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php on line 28 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php on line 26 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php on line 26 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 870 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/product.photocrati_nextgen.php on line 69 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php on line 41 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/nggallery.php on line 248 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/nggallery.php on line 249 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 214 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/on-this-day/OnThisDay.php on line 465 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 214 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 91 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 92 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 93 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 94 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 95 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 96 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 97 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 98 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 99 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/organize-series/orgSeries.php on line 100 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/w3-total-cache/inc/define.php on line 1478 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/w3-total-cache/inc/define.php on line 1478 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/w3-total-cache/inc/define.php on line 1478 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/w3-total-cache/inc/define.php on line 1478 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 214 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/wordpress-seo/wp-seo.php on line 41 Warning: require(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 219 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/wordpress-seo/wp-seo-main.php on line 94 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 314 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-settings.php on line 328 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/powerpress/powerpress.php on line 1212 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-includes/script-loader.php on line 51 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-includes/script-loader.php on line 566 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-includes/script-loader.php on line 51 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/redirection/models/match.php on line 74 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/redirection/models/action.php on line 24 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/wordpress-seo/wp-seo-main.php on line 94 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: include_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/nextgen-gallery/pope/lib/class.component_registry.php on line 939 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-blog-header.php on line 16 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/plugins/wordpress-seo/wp-seo-main.php on line 94 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-includes/template-loader.php on line 74 Warning: require_once(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-includes/template.php on line 501 Warning: include(): Unable to allocate memory for pool. in /var/www/sachachua.com/blog/wp-content/themes/sacha-v3/header.php on line 1 Common networking errors - sacha chua :: living an awesome life

Common networking errors

Due 2004.02.23 11:59:59 PM: Source code and detailed notes on

- changes made
- problems encountered
- solutions tried/found
- outstanding problems
- plans for next step

I don’t expect everyone to have a fully-working game by tomorrow, so
most of your partial points will come from the notes. “It doesn’t
work.” isn’t enough; I need to know why it doesn’t work, if it used to
work before, what you’ve tried doing to get it to work, why you think
it doesn’t work, etc.

Along the way to your first milestone, you may have encountered the
following problems:

- ObjectInputStream seems to hang when you create it.

That happens when both sides of the connection try to create object
input streams at the same time, but the other side hasn’t opened an
object output stream yet. Fix: create the object output stream first
before you create the input stream.

ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());

- Your program lags terribly.

How are you doing your networking and repainting code? If you’re doing
animation, repaint() should be in one thread and your networking code
should be in another. You shouldn’t do them in the same thread because
then repaint() will only happen whenever something is received from
the socket connection. Also, make sure you have delays somewhere!
while (true) { repaint(); } means your CPU will spend
most of its time repainting. Add a Thread.sleep in that loop so that
your computer has time to do other things.

- You can’t write certain objects over the stream.

Make sure the object is serializable and all of its attributes are
either transient or serializable as well. You really shouldn’t be
sending your entire application over the network – what is the other
side going to do with all those textfields? Mark many of your
attributes transient or create a small, simple object that
encapsulates the data you need to send.

- You’ve sent an object over the network connection and you’re calling methods on it on the other side, but the one on the first computer isn’t changing!

That’s the way it works. If you send an object from computer A to
computer B, computer B isn’t working on the original object but on a
copy of it. Any changes on A won’t be automatically sent to B and vice
versa. The correct thing to do is examine the object and perform
different actions locally.

If you really need to get something like this working and you have
plenty of spare time, read up on RMI (Remote Method Invocation). It’s
out of the scope of CS21B, though.

For tonight, I want lots and lots of notes.

TOMORROW: Data structures (stacks, queues and linked lists).