This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#601 2012-08-14 02:14:31

lallaway12
Scratcher
Registered: 2012-01-04
Posts: 500+

Re: Chat.PY and Other Features

DigiTechs wrote:

lallaway12 wrote:

Anybody on?

i'm on - and so is ohaider - we were just testing some chatbombs (mine's the spamming kind, his is the disconnecting kind) -- It was his idea, so don't blame me  tongue

I was talking to you (with FilterKeys on *facepalm*) and you were BOTS!


http://i49.tinypic.com/2re4ied.png

Offline

 

#602 2012-08-14 10:34:08

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

If you can't delete rooms, then just leave them. In about a month, I'm sure Chat.PY 3.0 will be out and we'll probably start fresh.  smile

For the latency idea, create a variable called "Latency" then add the 'reset timer' block under the broadcast in the main script, then in the new_message script, at the bottom of it, add 'set Latency to (timer)'.

Latency is mostly a client side thing, but I'll add it to the Chat.PY 3.0 client. It would be interesting to know how long it took to send the last message.  smile

Offline

 

#603 2012-08-14 22:15:03

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

Server is down.


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#604 2012-08-14 23:14:49

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

zippynk wrote:

Server is down.

Up now.  smile

Offline

 

#605 2012-08-15 14:37:33

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Chat.PY and Other Features

Sorry if I broke anything. I was testing a new feature on my MeshServe application, and things went badly wrong...

Edit: Is it meant to be constantly sending the byte 0, or is that a bug in my code?

Last edited by TheSuccessor (2012-08-15 14:42:59)


/* No comment */

Offline

 

#606 2012-08-15 15:05:49

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

TheSuccessor wrote:

Sorry if I broke anything. I was testing a new feature on my MeshServe application, and things went badly wrong...

Edit: Is it meant to be constantly sending the byte 0, or is that a bug in my code?

Could you explain, and possibly post your code?

Offline

 

#607 2012-08-15 15:25:52

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Chat.PY and Other Features

Magnie wrote:

Could you explain, and possibly post your code?

I'm currently working on this mesh server, and an upcoming feature is (probably) going to be using the server to connect to another mesh server, such that mine is effectively used as either a proxy, or a method of grouping multiple clients as one.

I was testing the feature with your server, and mine broke. Hopefully yours didn't crash, I think mine just got overwhelmed sending data to scratch. In this instance I was using it as a proxy between your project and your server. It's probably a problem with my code, and you needn't bother solving it - I was using your server to test it only because it's almost always up, publicly available and is running on a different computer to mine.

Anyway, here's the code:

Client.java:

Code:

package org.domclark.meshserve;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client implements Runnable {

    private static int exceptionBreak = 12;

    private Server server;
    private Socket sock;
    private InputStream in;
    private OutputStream out;
    private boolean muted;
    private boolean running;
    private Thread listener;

    public Client(Server server, Socket sock){
        this.server = server;
        this.sock = sock;
        this.muted = false;
        try {
            in = sock.getInputStream();
            out = sock.getOutputStream();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void listen(){
        running = true;
        listener = new Thread(this, "Client listener for " + ip() + ":" + port());
        listener.start();
    }

    public void write(String s){
        byte[] string = s.getBytes();
        int size = string.length;
        byte[] sizefield = new byte[]{
                (byte) ((size >> 24) & 0xff),
                (byte) ((size >> 16) & 0xff),
                (byte) ((size >> 8) & 0xff),
                (byte) (size & 0xff)
        };
        try {
            out.write(sizefield);
            out.write(string);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void close(){
        running = false;
        try {
            out.close();
            sock.close();
            if(listener.isAlive() && Thread.currentThread() != listener) listener.join();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void run(){
        int exceptions = 0;
        byte[] sizefield = new byte[4];
        byte[] buf = new byte[128];
        while(running){
            try {
                in.read(sizefield, 0, 4);
                int size = (sizefield[0] & 0xff) << 24 |
                        (sizefield[1] & 0xff) << 16 |
                        (sizefield[2] & 0xff) << 8 |
                        (sizefield[3] & 0xff);
                if(buf.length < size) buf = new byte[size];
                in.read(buf, 0, size);
                server.input(this, new String(buf, 0, size));
                exceptions = 0;
            } catch (IOException e) {
                if(e.getMessage().equals("Connection reset")){
                    server.removeConnection(this);
                    return;
                }
                if(running && exceptions == 0) e.printStackTrace();
                if(++exceptions >= exceptionBreak) running = false;
            }
        }
    }

    public String ip(){
        return sock.getInetAddress().getHostAddress();
    }

    public int port(){
        return sock.getPort();
    }

    public void setMuted(boolean muted){
        this.muted = muted;
    }

    public boolean isMuted(){
        return muted;
    }

    protected void finalize(){
        running = false;
        try {
            out.close();
            sock.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

Server.java:

Code:

...

        try {
            Socket s = new Socket("scratch.playfultest.tk", MESH_PORT);
            host = new Client(this, s);
            host.listen();
            gui.clientUpdated(true);
        } catch (UnknownHostException e) {
            gui.log("Failed to connect");
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

...

(MESH_PORT is 42001, obviously. The exceptionBreak and similar in the client just causes the server to give up after 12 consecutive exceptions on the input stream.)


/* No comment */

Offline

 

#608 2012-08-15 19:41:11

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

zippynk wrote:

Also, what's the room called "danger"?

DigiTechs wrote:

we were just testing some chatbombs

Need I say more?  tongue


Fork Clamor on GitHub!

Offline

 

#609 2012-08-17 13:54:21

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Anyone want to go on?


Fork Clamor on GitHub!

Offline

 

#610 2012-08-17 19:40:56

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

ohaiderstudios wrote:

Anyone want to go on?

Ok

EDIT: didn't see how long ago that was posted until I posted and compared post times. ok anyway.

Last edited by zippynk (2012-08-17 19:42:18)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#611 2012-08-21 17:47:15

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

ohaiderstudios wrote:

Anyone want to go on?


Fork Clamor on GitHub!

Offline

 

#612 2012-08-22 19:12:48

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Everyone wants to go on!

I hope

Last edited by ohaiderstudios (2012-08-22 19:13:03)


Fork Clamor on GitHub!

Offline

 

#613 2012-08-22 20:20:34

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Chat.PY and Other Features

Is there  link to the CHAT here? I can't find it...or maybe I;m just stupid.  tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#614 2012-08-22 20:53:26

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

mythbusteranimator wrote:

Is there  link to the CHAT here? I can't find it...or maybe I;m just stupid.  tongue

First download this project
Then, do either of the following:
  1) Join mesh to scratch.playfultest.tk
  2) Enable remote sensor connections (by right-clicking the sensor value block) and click here
Alternate Methods:
  1) Windows Application (EXE)
  2) Online Version (not very reliable)

DISCLAIMER: I tried to paraphrase Magnie's post, to not copy it exactly, but I may have failed in some places. So there might be some direct quotes that I don't know of.


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#615 2012-08-23 15:43:53

playzooki
Scratcher
Registered: 2012-02-07
Posts: 100+

Re: Chat.PY and Other Features

What is a chatbomb?


I iz a sig. So there. CLICK ME ITS SO IMPORTANT!!!!

Offline

 

#616 2012-08-23 15:53:25

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

playzooki wrote:

What is a chatbomb?

Sending a ton of messages in a small amount of time.

Offline

 

#617 2012-08-23 15:58:11

playzooki
Scratcher
Registered: 2012-02-07
Posts: 100+

Re: Chat.PY and Other Features

Magnie wrote:

playzooki wrote:

What is a chatbomb?

Sending a ton of messages in a small amount of time.

Cool I made one, tested it in danger AND IT WORKS. it posted 2352 messages in 71 seconds.(33.12676056338028 per sec)
BTW Its lonely.

Last edited by playzooki (2012-08-24 15:59:42)


I iz a sig. So there. CLICK ME ITS SO IMPORTANT!!!!

Offline

 

#618 2012-08-24 12:58:17

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Magnie wrote:

playzooki wrote:

What is a chatbomb?

Sending a ton of messages in a small amount of time.

Or disconnecting everyone in the room.  tongue


Fork Clamor on GitHub!

Offline

 

#619 2012-08-24 15:58:21

playzooki
Scratcher
Registered: 2012-02-07
Posts: 100+

Re: Chat.PY and Other Features

ohaiderstudios wrote:

Magnie wrote:

playzooki wrote:

What is a chatbomb?

Sending a ton of messages in a small amount of time.

Or disconnecting everyone in the room.  tongue

How do you do that?  tongue


I iz a sig. So there. CLICK ME ITS SO IMPORTANT!!!!

Offline

 

#620 2012-08-24 18:48:19

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

playzooki wrote:

ohaiderstudios wrote:

Magnie wrote:

Sending a ton of messages in a small amount of time.

Or disconnecting everyone in the room.  tongue

How do you do that?  tongue

It's a mod-only command. (And mods using it for a chatbomb is usually considered mod power abuse. I think.)

Last edited by zippynk (2012-08-24 18:49:09)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#621 2012-08-24 21:43:59

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

zippynk wrote:

playzooki wrote:

ohaiderstudios wrote:


Or disconnecting everyone in the room.  tongue

How do you do that?  tongue

It's a mod-only command. (And mods using it for a chatbomb is usually considered mod power abuse. I think.)

Without full consent from all connected parties, yes  tongue


Fork Clamor on GitHub!

Offline

 

#622 2012-08-26 12:24:56

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

aNyONE
want to
gO
oNliNE
on 2.0 chat.Py.sB


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#623 2012-08-26 22:28:23

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Chat.PY and Other Features

I have created... THE DANGER SERVER!!!
It's a Chat.PY server for testing chatbombs.
danger.thegt.org


http://i.imgur.com/BAEgGDL.png

Offline

 

#624 2012-08-27 19:37:10

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Is anyone else having problems connecting to scratch.playfultest.tk?


Fork Clamor on GitHub!

Offline

 

#625 2012-08-27 21:11:05

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Chat.PY and Other Features

ohaiderstudios wrote:

Is anyone else having problems connecting to scratch.playfultest.tk?

Yeah, the server must be down.


http://i.imgur.com/BAEgGDL.png

Offline

 

Board footer