blob8108 wrote:
Have you considered using a framework like Twisted for this sort of thing? I imagine it could make things easier (or sometimes just unnecessarily complicated )
I oh so very much dislike Twisted. It gives me too many problems.
MathWhiz: You haven't sent any data from what I can see.
Last edited by Magnie (2011-12-22 16:11:44)
Offline
Is the server using exactly the same code?
Offline
blob8108 wrote:
Is the server using exactly the same code?
What do you mean?
Okay, I got something "morning. How are you?" but it wasn't sent as a variable. ( 0000<chat Morning. How are you? )
Offline
Magnie wrote:
blob8108 wrote:
Is the server using exactly the same code?
What do you mean?
Okay, I got something "morning. How are you?" but it wasn't sent as a variable. ( 0000<chat Morning. How are you? )
That wasn't me...
Offline
Magnie wrote:
blob8108 wrote:
Is the server using exactly the same code?
What do you mean?
Sorry — I mean, what's listening on 174.27.218.81:6112? More Python code?
Magnie wrote:
Okay, I got something "morning. How are you?" but it wasn't sent as a variable. ( 0000<chat Morning. How are you? )
Sorry, that was me telneting to the port to see if it worked...
Offline
MathWizz wrote:
Magnie wrote:
blob8108 wrote:
Is the server using exactly the same code?
What do you mean?
Okay, I got something "morning. How are you?" but it wasn't sent as a variable. ( 0000<chat Morning. How are you? )That wasn't me...
Hmm, oh well.
Edit:
blob8108: Then the telnet worked. All that is listening on 6112 is Python.
Last edited by Magnie (2011-12-22 16:21:00)
Offline
Magnie wrote:
All that is listening on 6112 is Python.
Is it the same mirror code running at your end, too?
Offline
blob8108 wrote:
Magnie wrote:
All that is listening on 6112 is Python.
Is it the same mirror code running at your end, too?
No. All it is, is the server. But I am running a mirror on my own computer to send and receive messages to and from the server.
Offline
Magnie wrote:
blob8108 wrote:
Is it the same mirror code running at your end, too?
No. All it is, is the server. But I am running a mirror on my own computer to send and receive messages to and from the server.
And Scratch is acting as the server, yes?
Last edited by blob8108 (2011-12-22 16:24:19)
Offline
blob8108 wrote:
Magnie wrote:
blob8108 wrote:
Is it the same mirror code running at your end, too?
No. All it is, is the server. But I am running a mirror on my own computer to send and receive messages to and from the server.
And Scratch is acting as the server, yes?
No, it's just Python. Using Scratch as a server is the worst idea ever.
Offline
Magnie wrote:
blob8108 wrote:
Magnie wrote:
No. All it is, is the server. But I am running a mirror on my own computer to send and receive messages to and from the server.And Scratch is acting as the server, yes?
No, it's just Python. Using Scratch as a server is the worst idea ever.
So I'd've thought -- I understand now; it just echoes things to each client.
Offline
blob8108 wrote:
Magnie wrote:
blob8108 wrote:
And Scratch is acting as the server, yes?No, it's just Python. Using Scratch as a server is the worst idea ever.
So I'd've thought -- I understand now; it just echoes things to each client.
Well. In a way I guess: http://scratch.mit.edu/forums/viewtopic.php?id=83823 <- that is the un-updated code for the server.
Offline
MathWizz wrote:
Did you see the message, "You'd better see this. D:"?
Nope, it didn't show up.
Offline
MathWizz wrote:
I received something! Now?
Yeah, I'm getting stuff now.
Make sure your mirror can receive and send at the same time.
Offline
MathWizz wrote:
Your server is not sending a broadcast telling Scratch to update the log. Is it supposed to?
It is. I'm getting your messages:
Overlap wait time... Following 'chat' variable. Overlap wait time... Magnie has joined! Magnie: Hmm Magnie: You still on? MathWizz: Hmm? Magnie: I think it works MathWizz: Ello? Magnie: Hiya Magnie: Are you getting my messages? MathWizz: Ello?? MathWizz: Hmm.... Magnie: Hi Magnie: Are you getting my messages....? MathWizz: This is Math. :D MathWizz: ... Magnie: ... MathWizz: Testing with quotes. >:) MathWizz: "Hi!" Magnie: Hiya Magnie: Hello? MathWizz: Hmm... That worked... ""\674\][\]623[45\]756\3%$|^%$\63%$\^5\4*|}67'8\"
I don't think you are receiving my messages, what is your mirror code?
Last edited by Magnie (2011-12-22 17:08:08)
Offline
import java.net.*; import java.io.*; import java.util.*; public class Mirror { public static void main(String[] args) { try { Socket scratch = new Socket("127.0.0.1", 42001); System.out.println("Connected to Scratch!"); Socket server = new Socket("scratch.playfultest.tk", 6112); System.out.println("Connected to Magnie's server!"); BufferedReader scratchin = new BufferedReader(new InputStreamReader(scratch.getInputStream())); BufferedWriter scratchout = new BufferedWriter(new OutputStreamWriter(scratch.getOutputStream())); BufferedReader serverin = new BufferedReader(new InputStreamReader(server.getInputStream())); BufferedWriter serverout = new BufferedWriter(new OutputStreamWriter(server.getOutputStream())); int i; boolean serverNeedsFlush = false; boolean scratchNeedsFlush = false; while (true) { if (scratchin.ready()) { i = scratchin.read(); serverout.write(i); serverNeedsFlush = true; } else if(serverNeedsFlush) { serverout.flush(); serverNeedsFlush = false; } if (serverin.ready()) { i = serverin.read(); System.out.print((char)i); scratchout.write(i); scratchNeedsFlush = true; } else if(scratchNeedsFlush) { scratchout.flush(); scratchNeedsFlush = false; } } } catch (IOException e) { System.out.println("Error!"); e.printStackTrace(); System.exit(0); } } }
EDIT: Yeah, it's Java.
Last edited by MathWizz (2011-12-22 17:09:42)
Offline
MathWizz wrote:
Code:
import java.net.*; import java.io.*; import java.util.*; public class Mirror { public static void main(String[] args) { try { Socket scratch = new Socket("127.0.0.1", 42001); System.out.println("Connected to Scratch!"); Socket server = new Socket("scratch.playfultest.tk", 6112); System.out.println("Connected to Magnie's server!"); BufferedReader scratchin = new BufferedReader(new InputStreamReader(scratch.getInputStream())); BufferedWriter scratchout = new BufferedWriter(new OutputStreamWriter(scratch.getOutputStream())); BufferedReader serverin = new BufferedReader(new InputStreamReader(server.getInputStream())); BufferedWriter serverout = new BufferedWriter(new OutputStreamWriter(server.getOutputStream())); int i; boolean serverNeedsFlush = false; boolean scratchNeedsFlush = false; while (true) { if (scratchin.ready()) { i = scratchin.read(); serverout.write(i); serverNeedsFlush = true; } else if(serverNeedsFlush) { serverout.flush(); serverNeedsFlush = false; } if (serverin.ready()) { i = serverin.read(); System.out.print((char)i); scratchout.write(i); scratchNeedsFlush = true; } else if(scratchNeedsFlush) { scratchout.flush(); scratchNeedsFlush = false; } } } catch (IOException e) { System.out.println("Error!"); e.printStackTrace(); System.exit(0); } } }EDIT: Yeah, it's Java.
Hmm, I can't tell if it can send and receive at the same time...
What what I can see is this:
1. Scratch Sends Message
2. Server Sends a Message Back
3. Scratch Sends Message
4. etc
it needs to do both at once:
1. Scratch sends message server sends message
2. etc
Offline
MathWizz wrote:
Hmm... I could try setting up threads to do it at the same time. I don't think that will change anything though.
Hmm... Try the Python client for a bit.
I'm getting your messages, so I can't see why you aren't getting mine...
Last edited by Magnie (2011-12-22 17:17:47)
Offline
This is what my scripts look after I'm done:
Is that right?
Offline
Solarbuddy wrote:
This is what my scripts look after I'm done:
http://troll.ws/mRoIWD
Is that right?
No.
It's When I Receive "^follow_update"
Last edited by Magnie (2011-12-22 17:54:19)
Offline