how do i stop reqest.finish() (twisted .web server)from closing the http connection - twisted

I have written a chat server which writes a message line on the browser of one client to other client. The problem is that if i use request.finish() the output is shown but the connection is closed .if i dont use request.finish () the browser or program buffers the output and displaying output only after 20 or so request have been send.however the connection remains open.

I think best approach is reconnecting client just after receiving a message and closing connection.

Related

Attach stdin of docker container via websocket

I am using the chrome websocket client extension to attach to a running container calling the Docker remote API like this:
ws://localhost:2375/containers/34968f0c952b/attach/ws?stream=1&stdout=1
The container is started locally from my machine executing a jar in the image that waits for user input. Basically I want to supply this input from an input field in the web browser.
Although I am able to attach using the API endpoint, I am encountering a few issues - probably due to my lackluster understanding of the ws endpoint as well as the bad documentation - that I would like to resolve:
1) When sending data using the chrome websocket client extension, the frame appears to be transmitted over the websocket according to the network inspection tool. However, the process running in the container waiting for input only receives the sent data when the websocket connection is closed - all at once. Is this standard behaviour? Intuitively you would expect that the input is immediately sent to the process.
2) If I attach to stdin and stdout at the same time, the docker deamon gets stuck waiting for stdin to attach, resulting in not being able to see any output:
[debug] attach.go:22 attach: stdin: begin
[debug] attach.go:59 attach: stdout: begin
[debug] attach.go:143 attach: waiting for job 1/2
[debug] server.go:2312 Closing buffered stdin pipe
[error] server.go:844 Error attaching websocket: use of closed network connection
I have solved this opening two separate connections for stdin and stdout, which works, but is really annoying. Any ideas on this one?
Thanks in advance!

FIX Protocol 4.4 Connection not responding to Login

To anyone who can help,
I am having a show stopping issue connecting to the test server.
My TCP/IP connection is established via:
Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
I send the connection message to the server via:
_socket.Send(_txData);
where _txData is a byte[] _txData array initialized with the connection request message:
8=FIX.4.4\0019=121\00135=A\00149=NotRealSenderID\0 0156=NotRealTargetID\00134=1\00152=20140522-20:12:04.392\00198=0\001108=30\001554=NotRealPassw ord\00110=017\001 converted to a byte array.
I wait for the login success message via:
int responseCount = _socket.Receive(_rxBuffer);
but after a few seconds, the _socket.Receive unblocks and returns zero bytes suggesting unsuccessful connection.
What am I doing wrong?
Is my login message at fault? Is it the way I establish server connection? I am at a loss!
Currently, My default Windows 7 Firewall is disabled, and I attempted to telnet into the server, and the image below snapshots the outcome:
Any help will be appreciated, as this is a major show stopper for me.
Thanks.
I managed to resolve this issue. The problem was with the SOH character in my message.
I was using the literal SOH = "\001" converted to a byte, when I should have done this: SOH = (char) 0x1; DUH!!
For the record, I used the following tools to 'debug' this issue:
Wireshark with display filter and capture filter set to the host server's ip address, and MINI-FIX to generate and transmit FIX messages to the host server.
I then compared the output from my client to those produced by MINI-FIX via Wireshark. It didn't take me long to spot the error from there.
What is "the test server" ?
Can you ping it ?
From the look of that telnet session you haven't permission to make a connection, or there is nothing running at the destination.

Bio_free not closing connection

I have developed a ssl client using the code shown in this website
http://www.chesterproductions.net.nz/blogs/it/c/an-ssl-client-using-openssl/245/
But after calling r = BIO_free(bio); the connection still does not get closed. Only after closing my client application does the connection close.
I am verifying this using CurrPorts software, which shows which all ports are in connected state.
I have tried BIO_ssl_shutdown(bio); but it didnt work either.
Ok I found the fault. It was the server not clearing its FD_SET which was creating an issue. Though I am not sure why it happened so :(

AT command to disconnect the dialup TAP connection

In our project, we dial a particular number, connect and then send the message successfully. After sending the message, we want to disconnect the call by sending the AT commands.
After sending the message successfully, we send #EOT#CR and then send +++ath0. It seems our dial up modem, does not disconnect call after we send +++ath0. When we see our usage on the carrier service provider website, it is showing the call duration of around up to 700 seconds. While on the debug terminal we can clearly see that the message sent successfully within less than 60 seconds.
Please give some guidance, why it does not disconnect the call.
Thanks.
AT Command for Hang-up(disconnect) dial-up modem is:
ATH
value:0 or 1
for example for disconnecting Send this String to Modem's port:
"ATH0;\r\n";
that semicolon determines you are able to send other AT commands.

MailMessage & MAIL/EXPN/VRFY/ETRN

I was told that my program was not issuing a MAIL/EXPN/VRFY/ETRN when sending an email by the web hosting company we are connecting to.
Anyone know what this means and how I do it?
I am sending an email with SmtpClient and I have no problems with other clients.
Here is what I was told:
Thanks for the additional info, here
is what I found...
Aug 4 11:16:48 smtp1 sendmail[2729]:
o74GGU5F002729:
xx-xx-xx-xx.static.xxx.mo.charter.com
[xx.xx.xx.xx] did not issue
MAIL/EXPN/VRFY/ETRN during connection
to TLSMTA
Notice the time and the IP address
which is your static from Charter. Now
here is a good connection.
Aug 4 11:18:22 smtp1 sendmail[2745]:
STARTTLS=server,
relay=xx.xx.xx.xx.static.xxx.mo.charter.com [xx.xx.xx.xx], version=TLSv1/SSLv3,
verify=NO, cipher=RC4-MD5,
bits=128/128 Aug 4 11:18:23 smtp1
sendmail[2745]: AUTH=server,
relay=xx.xx.xx.xx.static.stls.mo.charter.com
[xx.xx.xx.xx], authid=ronmid,
mech=LOGIN, bits=0
Since their email program did not
issue MAIL/EXPN/VRFY/ETRN during
connection, my server would not
continue the transaction.
Any suggestions?
Thanks!
You app didn't issue any of those 4 commands after connecting. This could be because the server didn't respond correctly and so your app was waiting for that response until it timed out. You can check this by trying to send an email with a simple telnet connection as described here. After you connect and send the EHLO or HELO command (depending on what the server wants) you should get a 250 response.
If you do get the 250 response with telnet but your app still doesn't work, then maybe it's something in your application that tries to send an incorrect command. Maybe you've setup your application to use SSL or credentials, and the SMTP server don't support that or something similar?