Sockets help



Someone emailed this to me but it is above my skills:

a very simple socket function, client and server. Works fine.

Now, through a proxy in between.

client socket connect to the proxy and ask proxy to forward the
message to server. In this case, proxy also make a socket connection
to server. Server puts data into the socket from proxy.

The situation is that, the socket has to close on Server in order for
the data to flow to proxy then back to client.

in client:

::http::config -proxyhost xxx.xxx.xx.xxx -proxyport 1234
::http::register http 1234 ::socket
http::geturl "http://yyy.yyy.yy.yy:5678 -handler httpdisplay

proc httpdisplay { socket token } {
puts [gets $socket]
}

proxy is locate at xxx.xxx.xx.xxx of port 1234

server side:

socket -server Accept 5678

proc Accpet { sock addr port } {
fconfigure $sock -buffering none -blocking 0
fileevent $sock readable [list display $sock $addr $port]
}

proc display { sock addr port } {
set line [gets $sock]
puts $sock "Data received: $line"
flush $sock
}

Well, the problem is that if I don't use proxy,

httpdisplay output data right away. But if I used proxy, then no data
will show until I put a close in proc display in Server side after I
wrote the data to $sock.

Can you help?

Thanks,

.



Relevant Pages

  • Re: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Please enter password for HTTP proxy
    ... Web Proxy log: WEBEXTDyyyymmdd.log ... This newsgroup only focuses on SBS technical issues. ... |> on to the SBS server that hosts the ISA. ... |> sure the problematic clients also have Firewall Client installed. ...
    (microsoft.public.windows.server.sbs)
  • RE: Proxy requires authentication
    ... problem where it is being asked to authenticate to the proxy server. ... sure the problematic client also have Firewall Client installed. ... | Thread-Topic: Proxy requires authentication ...
    (microsoft.public.windows.server.sbs)
  • Re: ISA Server Problems, please help
    ... The All access rule for SBS Internet ... Web Proxy and/or ... > To accommodate the linux SecureNAT clients you should create a new Client ... ISA Server denies the specified Uniform Resource Locator. ...
    (microsoft.public.windows.server.sbs)
  • Re: Locking on async calls
    ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
    (microsoft.public.dotnet.general)