Re: [twsocket] TWsocket connection error 10048
I have got to the bottom of the Error 10048 This means the port you are trying to use is already used and thus is no more available. It seems that the order in witch you assign values to the TWSocket properties when you want to open a client is important - so now I can open and close the client heaps of times with out the error 10048 being raised :-) The code I was using looked like this TheTCPClientSocket-Proto = tcp; TheTCPClientSocket-Port= TCP_ClientPort; TheTCPClientSocket-Addr= TCP_ClientAddress; TheTCPClientSocket-LocalPort = TCP_ClientPort; TheTCPClientSocket-LocalAddr = 0.0.0.0; TheTCPClientSocket-Connect(); The correct code that works looks like this TheTCPClientSocket-Addr= TCP_ClientAddress; TheTCPClientSocket-Proto = tcp; TheTCPClientSocket-Port= TCP_ClientPort; TheTCPClientSocket-Connect(); Does anyone know why this is the case ??? When you don't assign the LocalPort, Windows automatically assign an available local port. This is usually what is done for connecting to a remote host. If you have any reason not to do so, just explain why. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OverbyteIcsHttpProt suggestions
ICS guys, I humbly ask you to pay attention on my previous message. -- Anton -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OverbyteIcsHttpProt suggestions
Hello Anton, 1) Excess ancient defines The code is cleaned up as we goes by. 3) HTTPCliWindowProc function HTTPCliWindowProc is never used, maybe it should be removed? If not used anymore, yes. 2) $IF defines Same as (1) 4) THttpBigInt THttpBigInt type - is it really needed? Strictly not needed, but make code easier to update. 5) Header value names Yes, indeed. Altough it probably wouldn't change anything. 6) Current http doc properties clearing Yes, indeed. 7) Last-modified and Date header fields I don't see exactly what you mean. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be - Original Message - From: Anton S. an...@rambler.ru To: twsocket@elists.org Sent: Thursday, April 07, 2011 1:29 PM Subject: [twsocket] OverbyteIcsHttpProt suggestions I'm now working with HttpCli and after examining OverbyteIcsHttpProt unit I have several suggestions 1) Excess ancient defines While only D7+ is supported currently in ICS7, there are some legacy defines: {$IFNDEF COMPILER7_UP} 'Sorry, we do not want to support ancient compilers any longer' {$ENDIF} {$IFDEF DELPHI6_UP} useless {$WARN SYMBOL_PLATFORM OFF} {$WARN SYMBOL_LIBRARYOFF} {$WARN SYMBOL_DEPRECATED OFF} {$ENDIF} {$IFDEF BCB3_UP} {$IFDEF BCB} ? {$ObjExportAll On} {$ENDIF} There's even some code for DELPHI1! 2) $IF defines While COMPILER##_UP defines are used for determining compiler version, there are some checks with $IF like {$IF CompilerVersion 21}. Maybe it's better to change compiler detection to IF-s? IF-s are supported in D7, the only thing this version requires is defining a const CompilerVersion = 15. 3) HTTPCliWindowProc function HTTPCliWindowProc is never used, maybe it should be removed? 4) THttpBigInt THttpBigInt type - is it really needed? 5) Header value names Such header value names as 'Content-Length: ' are repeated several times throughout the unit, I think they should be declared as constants. 6) Current http doc properties clearing There's a block of code which clears http doc properties, it is repeated three times: once in THttpCli.InternalClear and twice in THttpCli.LocationSessionClosed. { Clear header from previous operation } FRcvdHeader.Clear; FHeaderLineCount := 0; FBodyLineCount:= 0; FContentLength:= -1; FContentType := ''; { 25/09/1999 } FTransferEncoding := ''; { 28/12/2003 } {$IFDEF UseContentCoding} FContentEncoding := ''; {$ENDIF} I'd extract this into separate method (what would ease addition of new http doc properties) 7) Last-modified and Date header fields I slightly modified RFC1123_Date and RFC1123_StrToDate and added auto-conversion of Last-modified and Date header fields into HttpCli's TDateTime fields. If you're interested, I can send my modifications to ICS team. -- Anton -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Receive log file text
That's too bad. -Original Message- From: Arno Garrels Sent: Tuesday, April 12, 2011 7:15 PM To: ICS support mailing Subject: Re: [twsocket] Receive log file text daniel cc wrote: Thanks Arno :) I understand perfectly, Do we have any samples about this? I do not think so. About the file size, the log file can be sometimes bigger than 3mb, does that makes problem? it normally will be around 0-3mb That's no problem, the filesize since D6/7 may be even greater than 2 GB. It was limited to 2GB max in older Delphi versions since TStream did not use Int64. -- Arno Garrels -Original Message- From: Arno Garrels Sent: Tuesday, April 12, 2011 4:40 PM To: ICS support mailing Subject: Re: [twsocket] Receive log file text daniel cc wrote: Hi, Can someone please help me out w ith a sample of how to, send a log (text file) from client to the server? My connection is with ICSSLServer and ICSSSLClient. That works the same way as without SSL. And it depends on your protocol. Typically you send a request to the server telling him that you want to send a file. The request would include filename and filesize in bytes. When the server received the request it opens an filestream, turns off LineMode and sends back an OK-response or any error code. On receipt of the OK-response the client opens the file, reads from it into a small buffer i.e. 4-16 KB and sends the buffer content. The client sends subsequent data chunks from event OnDataSent until the file is completely sent. The server simply receives into a small buffer and writes buffer content to the filestream until filesize has been reached. The server turns on LineMode back again and sends a response to the client telling him whether everyting went well or some error occurred. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Receive log file text
daniel cc wrote: That's too bad. I hope my description was useful to get the picture. The implementation is up to you and should be an easy task for a (Delphi) developer IMO. If you run into problems specific to ICS please ask your question in the list. -- Arno Garrels -Original Message- From: Arno Garrels Sent: Tuesday, April 12, 2011 7:15 PM To: ICS support mailing Subject: Re: [twsocket] Receive log file text daniel cc wrote: Thanks Arno :) I understand perfectly, Do we have any samples about this? I do not think so. About the file size, the log file can be sometimes bigger than 3mb, does that makes problem? it normally will be around 0-3mb That's no problem, the filesize since D6/7 may be even greater than 2 GB. It was limited to 2GB max in older Delphi versions since TStream did not use Int64. -- Arno Garrels -Original Message- From: Arno Garrels Sent: Tuesday, April 12, 2011 4:40 PM To: ICS support mailing Subject: Re: [twsocket] Receive log file text daniel cc wrote: Hi, Can someone please help me out w ith a sample of how to, send a log (text file) from client to the server? My connection is with ICSSLServer and ICSSSLClient. That works the same way as without SSL. And it depends on your protocol. Typically you send a request to the server telling him that you want to send a file. The request would include filename and filesize in bytes. When the server received the request it opens an filestream, turns off LineMode and sends back an OK-response or any error code. On receipt of the OK-response the client opens the file, reads from it into a small buffer i.e. 4-16 KB and sends the buffer content. The client sends subsequent data chunks from event OnDataSent until the file is completely sent. The server simply receives into a small buffer and writes buffer content to the filestream until filesize has been reached. The server turns on LineMode back again and sends a response to the client telling him whether everyting went well or some error occurred. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] UDP Receive problem
Hi I´m experiencing a very weird problem and I hope someone can help me My application receives UDP data from IP Cameras, somehow we are not receiving some packets, but by using a network sniffer I can see that the packet was received, but the application never receives it! I´m using TWSocket to receive UDP data I already checked receive buffer lengths.. I actually spent 2 entire days cheking for solutions but I couldn´t find anything Have anybody already experienced something like this? Thanks Eric -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] TWsocket connection error 10048
Hi... Quote: When you don't assign the LocalPort, Windows automatically assign an available local port. This is usually what is done for connecting to a remote host. If you have any reason not to do so, just explain why. If I use this code: TheTCPClientSocket-Addr = TCP_ClientAddress; TheTCPClientSocket-Proto = tcp; TheTCPClientSocket-Port = TCP_ClientPort; TheTCPClientSocket-LocalPort = TCP_ClientPort; TheTCPClientSocket-Connect(); Then I can connect OK, but the second time I connect I get the 10048 if done a few seconds after I close the connection - if I wait 1 minute after I disconnect and then reconnect, all is OK If I use this code: TheTCPClientSocket-Addr = TCP_ClientAddress; TheTCPClientSocket-Proto = tcp; TheTCPClientSocket-Port = TCP_ClientPort; TheTCPClientSocket-Connect(); Then I can connect, disconnect and then reconnect many times over a 1 minute period === So This leads me to think that TWSocket is not closing/freeing/de-allocating the LocalPort, such that when I try to reopen the connection a few seconds after I close it, windows raises the 10048 error due to the LocalPort still being allocated Is this the case This is the code called when I want to close the Client connection TheTCPClientSocket-Close(); Is there something else I need to call ?? Thanks Ray -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] UDP Receive problem
My application receives UDP data from IP Cameras, somehow we are not receiving some packets, but by using a network sniffer I can see that the packet was received, but the application never receives it! I already checked receive buffer lengths.. I actually spent 2 entire days cheking for solutions but I couldn´t find anything At first glance, I would say that your receiving application is not able to receive the datagrams as fast as they are comming. So they are simply dropped from winsock buffer as new datagrams are comming in. I suggest you use a different thread for the newtork I/O (TWSocket) and for the computation and display. Let's name the thread with TWSocket a worker thread. The worker thread can be assigne high priority and build a large buffer to store datagrams until the main thread is able to process it. Pay attention to not use anything taking time ! Specially, do not use Synchronize. Of course you need a critical section to have the main thread and worker thread to acces the queue at the same time. Pay a lot of attention to the duration of the lock, make it as small as possible or you are back to your initial issue. Also note that this design will potentially cause trouble if the overall computation and display time is slower than the average network I/O speed, the your buffer will grow. At some time you'll be forced to drop datagrams yourself to avoid accumulating data. Another possibility is that you have a bug in your application which makes some datagrams unprocessed. Yest another possibility is that you have a security product which is bugged or takes too long to process. Many security product intercept the network I/O to check for malware. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] TWsocket connection error 10048
So This leads me to think that TWSocket is not closing/freeing/de-allocating the LocalPort, such that when I try to reopen the connection a few seconds after I close it, windows raises the 10048 error due to the LocalPort still being allocated Is this the case No, it isn't. But Windows TCP/IP stack does that. Try setting ReuseAddr property to true. Is there something else I need to call ?? Why would you assign LocalPort ? As I said in previous message, DO NOT ASSIGN LocalPort property. To connect to a remote host, only the (remote) Port is important. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be