http tunneling

I have problem with http tunneling, I cannot understand it. Can someone give me example code which can communicate with chat server, that means you should have opened in and out all time. Thanks.
[202 byte] By [boba5555a] at [2007-10-3 3:34:49]
# 1
What makes you think that the problem has to do with http tunneling?
jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 2

I want this. Suppose on client side I have

for (int i = 1 ; i < 4 ; i++)

sendToServer(i);

on server side I have

in = getFromClient();

sendToAllClients(clint.name + in);

that means I if I have two clients (client1 and client2) which send this in same time I will have something like this

client1:

client11

client12

client21

client13

client22

client23

client2:

client11

client12

client21

client13

client22

client23

actually I want to read and write in same time. I need a example code for this or something similar. I want to implement chat through http tunneling. I have implemented that using

InetAddress addr = InetAddress.getByName([some address]);

sock = new Socket(addr, TCP_PORT);

in = new BufferedReader(

new InputStreamReader(

sock.getInputStream()));

out = new PrintWriter(

new BufferedWriter(

new OutputStreamWriter(

sock.getOutputStream())), true);

Thanks.

boba5555a at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 3
I don't see anything in this that anything to do with http tunneling.For a chat server each client will have its own connection. You keep track of each connection seperately. If you want to send a message to all clients then you send the same message over each connection.
jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 4
Ok. Can you give me simple code which is connecting through http tunneling. Simple, I don't know how to code it. I need only simple example and that's all. Example which can read and write as chat should do that.Thanks.
boba5555a at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 5

> Ok. Can you give me simple code which is connecting

> through http tunneling.

Nothing you have posted so far suggests that http tunneling has anything at all to do with anything that you are doing.

Why do you think that it matters?

Are you getting an exception that tells you it matters? If so what is it?

jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 6
People i think you don't understand him. He just wants a simple implementation of http tunneling.
NemusNsa at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 7
He has right.Thanks NemusNs.
boba5555a at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 8
> People i think you don't understand him. > > He just wants a simple implementation of http> tunneling.That explains it.
jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 9

> He has right.

You understand that the communication works a follows?

1. Client send request to proxy (server). To do this the client connects to the proxy.

2. Proxy send request to the final destination. To do this the proxy connects to the final destination.

3. The final destination returns a response to the proxy.

4. The proxy returns (repackages) the response to the client.

jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 10

Yes, I understand (actually, I think I understand :))

Just, I don't know, can I have one connection client -> server, and one connection server -> clinet at once!?

It's very good if you have some short code to give me real example.Or I can post here simple chat code and you can tell me what I should change to work through http tunneling.

Thanks.

Message was edited by:

boba5555

boba5555a at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...
# 11

> Yes, I understand (actually, I think I understand

> :))

> Just, I don't know, can I have one connection client

> -> server, and one connection server -> clinet at

> once!?

>

Yes, you use threads. Each client connection is in its own threead.

The tutorial covers this and every book on java networking that I have seen.

jschella at 2007-7-14 21:29:25 > top of Java-index,Core,Core APIs...