topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
Client Server options | Rick,
Thanks for the tip.
Reinaldo,
I use Danie´s xbrowse sample in tDolphin which goes to an ISP located in USA (sitasoft.net), while I am accessing it from Spain.
It is inmediate. Very impresive.
But accessing xBrowse with AIS in a server located in Spain but with latency over 40 ms is very very slow. |
Client Server options | Reinaldo, I feel you are a little impolite in your answer to me.
Best regards,
Otto |
Client Server options | Otto;
I think you are right. I'm sorry.
Reinaldo. |
Client Server options | Lucas,
I'd like to test accessing your .dbf tables in Spain from here. Please send me the connection string (ip, port, path and name of the dd), user and passw to access the DD over AIS. Thank you.
Reinaldo. |
Client Server options | Reinaldo,
Now I set off the server.
But you can try Renee Flores sample with their server.
It is also very very slow:
<!-- m --><a class="postlink" href="http://goo.gl/gsCE8">http://goo.gl/gsCE8</a><!-- m --> |
Client Server options | Reinaldo, thank you.
Best regards,
Otto |
Client Server options | Reinaldo,
Did you try <!-- m --><a class="postlink" href="http://goo.gl/gsCE8">http://goo.gl/gsCE8</a><!-- m --> ?
Thanks. |
Client Server options | Lucas;
Sort of. Using arc I created a new dd connection to \\ciber-tec.d2g.com:2000\cursos\adsdemo\cibconwn\stc\internet.add I connect with username demo and password demo.
Once connected, the table branch on the connection repository tree will expand showing all available tables. I'm browsing table ABRPOL. It is a dbf/cdx table. It browses ok. Not too bad. However, I noticed that connection to that server (probably in Mexico) is not a fast one. Browsing a different Data Dictionary using ARC on a server in Texas is a lot faster.
I don't know ADO. Rick or Adolfo are better sources on that subject. But since ADO is tailored to work with result sets, I would think it does relatively faster xbrowsing over slow connections.
I can't see how AIS is much slower or faster. The difference between AIS and the remote server is that with AIS communication is encrypted-decrypted at both ends. What I think makes for slow xbrowsing over AIS is the connection speed itself and the fact that xbrowse is terrible with ADS RDDs, even with the Local and/or Remote servers and not just AIS. That's why I would try to test using ARC and the same connection to the same server as bench marks.
I will spend more time trying later. I will reply as soon as I have a chance. Thank you.
Reinaldo. |
Client Server options | Otto,
When I first started working with Harbour/xHarbour (.com ), the options were RDDCDX, Apollo, and ADS. I received a lot of input and elected to use ADS. They publish an excellent White Paper that made a lot of sense to me. For small installs, we can use ADS local and its free. However, I have clients with poorly behaving equipment ( not well maintained, subjected often to malware by the users, etc ), and ADS seemed to be a good safety alternative. So all of my larger installs are told to consider ADS.
Many of my clients exceed 5 workstations. I don't want to play with configuring their systems, and ADS is quick and easy to install. I tell people to start with the Peer to Peer ( LOCAL ), but when they don't like the performance, I give them a 30 day free trial of ADS. No one complains about the price after they see the performance improvement. For example, in an invoicing section, the program opens six .dbf files, with .fpt's and .cdx's, in a filtered mode. WIth peer to peer, this can be slow. With ADS its instantaneous. Since that is the area they spend the most time in each day, they see the performance boost.
My issue had to do with a resellers account. My account renews in June, and I was one sale short of a free status. Of course that may change before my anniversary date, but they were talking a stiff charge which I was unwilling to pay. That has since been resolved. Other then that issue, I have no problem with ADS.
I do have clients with up to 18 workstations, networked across multiple worksites.
The cost is relative. My clients might not want to pay the expense, but they can afford it. They just would rather spend the money outside of their business needs ! Also, it can be a one time cost. I have people who spent $ 650 US 8 years ago, for a 5 user license, and they have never upgraded it. They still use it to this day. Thats pretty cheap for a business.
You have done some very nice work with your product, and have found a multi-user option that fits your clients. I appreciate that work. However, I just didn't see it as the right solution for my clients.
Tim |
Client Server options | Reinaldo,
Please, try to use link provided.
It uses twbrowse.
Arc browser is different.
Yes, datas appear!!. But very slowly.
I think it is a point that Sybase could improve.
Best regards |
Client Server options | [quote:2s0j9q8y] "...the fact that xbrowse is terrible with ADS RDDs, even with the Local and/or Remote servers and not just AIS."[/quote:2s0j9q8y]
Reinaldo,
Could you explain ? I have not been using AIS ( issues with my ISP for testing ) but I do use ADS server ( REMOTE ) mode and my xbrowse implementations are all working quite quickly ( I guess thats a "real world" analysis based on what users are actually doing ). I do have some filters in place ( scopes, actually ), and I do use indexed browses, but I have no problems with xbrowse performance in a networked environment.
Perhaps you could clarify this statement.
Tim |
Client Server options | Lucas;
Ok. I just did. Whaoo, it is more than 100 times slower than with ARC. Try with ARC32 you will see it is 100 times faster than the supplied app on the .zip file.
The question is; why? It is the same AIS (server side), same server (linux, windows, novell? -doesn't matter), same internet connection, same tables, same records. The only thing that's different is the fw component vs a Delphi grid component.
We need to compare browsing speeds using the same components over the same connections to the same server where the only variable changing is the SQL engine itself. Doing this homework requires time and effort as well as knowledge on both technologies.
Before bringing this issue to Sybase R+D, we should be prepared to demonstrate that the problem is not xharbour/fw or our components, otherwise we are going to look like fools and they may never take us seriously. Keep in mind they have millions of users using Delphi, .net, php, Java, Pyton, oData web services, and other. AIS speed is not an issue for these users or at least non of them is complaining.
Perhaps we should start by stating a DB schema, then have the tables populated with the same data. Then start testing using the same server. Anyone says "I" ?
Reinaldo. |
Client Server options | Tim;
Yes, good question. The problem is not always manifested as it takes a given set of circumstances such as alternate row painting (pijama effect), table size, etc...
Here is a link to that subject as stated by Mr. Rao:
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=9343&hilit=why+are+slow+ADS">viewtopic.php?f=3&t=9343&hilit=why+are+slow+ADS</a><!-- l -->
Reinaldo. |
Client Server options | Several years ago, I followed the suggestions and used scopes rather than filters for my xbrowses. Maybe that is why everything works well.
Tim |
Client Server options | Reinaldo,
Thank you very much for your advice and comments.
I will test, because if I solve the problem with xBrowse, ADS will be the right choice.
It is also strange as Rene´s sample is build with tbrowse, which is faster than xBrowse.
Maybe Mr. Nages could help us. |
Client Server options | Timm,
Do you use xbrowses with AIS over Internet or just in LANS?.
In LANS they work fast, yes. And filters. |
Client Server options | I want to use them on the internet, but right now I have a server issue ( IP ). I will be exploring this soon.
Tim |
Client Server options | Hola a todos,
let me give some opinions about speed.
When we use ADO we maintain a data set locally, then this is faster that traditional Harbour RDD approach.
Other question about ARC vs. xBrowse, the problem is the xBrowse implementation, it refresh all the data many times for every event, it retrieve the same data showed in the page for every move event, maybe we can improve it adding caching capabilities
sorry for may good english
Regards
Marcelo |
Client Server options | Reinaldo,
This is the code i am using:
[code=fw:1svq9pou]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> Test_SQL<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cSql := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cAlias := <span style="color: #0000ff;">Alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #B900B9;">/*al inicio de la instruccion sql se define un area vacia*/</span><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">/*se define instruccion sql en una cadena de texto*/</span><br /> cSql := <span style="color: #ff0000;">"SELECT * FROM CUSTOMER"</span><br /> <span style="color: #0000ff;">msgINFO</span><span style="color: #000000;">(</span>csql, <span style="color: #ff0000;">"cSql"</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">/*crea instruccion sql y pasa los datos a tabla temporal*/</span><br /> ADSCreateSQLStatement<span style="color: #000000;">(</span> <span style="color: #ff0000;">"REPTMP"</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> ADSExecuteSQLDirect<span style="color: #000000;">(</span> cSql <span style="color: #000000;">)</span><br /><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #ff0000;">"REPTMP"</span><span style="color: #000000;">)</span><br /><br /> REPTMP-><span style="color: #000000;">(</span> DBGoTop<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> LastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> > <span style="color: #000000;">0</span> <span style="color: #B900B9;">// !REPTMP->( Eof() )</span><br /><br /> <span style="color: #B900B9;">/*lista resultado en tabla*/</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//aArray := FW_DbfToArray()</span><br /> <span style="color: #B900B9;">//XBROWSER aArray</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #B900B9;">/*no se encontro datos que cumpla condicion sql*/</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"No se ha encontrado REGISTROS"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*cierra tabla de datos temporal*/</span><br /> REPTMP-><span style="color: #000000;">(</span> DBCloseArea<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> Alert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"AdsExecuteSQLDirect() failed with error "</span>+ Str<span style="color: #000000;">(</span> ADSGetLastError<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /><br /> <span style="color: #B900B9;">/*se selecciona area de datos anterior*/</span><br /> <span style="color: #00C800;">IF</span> !Empty<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> DBSelectArea<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*da foco al browse*/</span><br /><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:1svq9pou]
This is my fastest approach.
Please, any suggestions?.
Using FW_DbfToArray() take more time than above code.
Thank you very much. Best regards |
Client Server options | Lucas;
Read Marcelo's comment. He is right on the money. You have to start by re-writing xbrowse, or use a grid component from a 3rd party specially made to manage sql result sets, or try with ADO. I think that ADO should work with any sql engine including ADS.
Best regards,
Reinaldo. |
Client Server options | Reinaldo,
Yes, the problem is that xBrowse evaluates too many times all events.
In fact, in local mode sometimes is slow, the more using ADS.
Do you know any 3rd grid that works with Fivewin?, |
Client Server options | lucas
You can still use the original Listbox class with Sql or .dbf .. here is a sql example with ADO. You will need to write your own skipper() like the one below.
Rick
[code=fw:2bcdgsln]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRsDEP:= TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.Recordset"</span> <span style="color: #000000;">)</span><br />oRsDEP:<span style="color: #000000;">CursorType</span> := <span style="color: #000000;">1</span> <span style="color: #B900B9;">// opendkeyset</span><br />oRsDEP:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// local cache</span><br />oRsDEP:<span style="color: #000000;">LockType</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// lockoportunistic</span><br /><br />cSQL := <span style="color: #ff0000;">"SELECT * FROM FREQUENCY order by FREQUENCY"</span><br /><br /><span style="color: #00C800;">TRY</span><br /> oRsDEP:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> cSQL,xCONNECT <span style="color: #000000;">)</span><br />CATCH oErr<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Error in Opening FREQUENCY table"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END <span style="color: #00C800;">TRY</span><br /><br /><span style="color: #00C800;">Do</span> <span style="color: #00C800;">Case</span><br /><span style="color: #00C800;">Case</span> nType = <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">IF</span> EMPTY<span style="color: #000000;">(</span> zFrequency <span style="color: #000000;">)</span><br /> zFrequency := <span style="color: #ff0000;">"BOGUS"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">Case</span> nType = <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">IF</span> EMPTY<span style="color: #000000;">(</span> zT_Freq <span style="color: #000000;">)</span><br /> zT_Freq := <span style="color: #ff0000;">"BOGUS"</span><br /> <span style="color: #00C800;">ENDIF</span><br />End <span style="color: #00C800;">Case</span><br /><br />*cNAME := UPPER<span style="color: #000000;">(</span>ALLTRIM<span style="color: #000000;">(</span>cNAME<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> oRsDep:<span style="color: #000000;">eof</span><br /><span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">IF</span> .not. oRsDEP:<span style="color: #000000;">eof</span><br /> oRsDEP:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">Case</span><br /> <span style="color: #00C800;">Case</span> nType = <span style="color: #000000;">1</span><br /> oRsDEP:<span style="color: #000000;">Find</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"FREQUENCY LIKE '"</span>+upper<span style="color: #000000;">(</span>alltrim<span style="color: #000000;">(</span>zFrequency<span style="color: #000000;">)</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"%'"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Case</span> nType = <span style="color: #000000;">2</span><br /> oRsDEP:<span style="color: #000000;">Find</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"FREQUENCY LIKE '"</span>+upper<span style="color: #000000;">(</span>alltrim<span style="color: #000000;">(</span>zT_Freq<span style="color: #000000;">)</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"%'"</span> <span style="color: #000000;">)</span><br /> End <span style="color: #00C800;">Case</span><br /><br /> <span style="color: #00C800;">IF</span> oRsDEP:<span style="color: #000000;">eof</span><br /> oRsDEP:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />lOK2 := .F.<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"FREQSLCT"</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #ff0000;">"W+/W"</span> ;<br /> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Frequency Select"</span> ;<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLBX FIELDS ;<br /> <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>,<span style="color: #ff0000;">" "</span>,oRsDep:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FREQUENCY"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>;<br /> HEADERS <span style="color: #ff0000;">"Frequency"</span> ;<br /> SIZES <span style="color: #000000;">90</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">111</span> <span style="color: #0000ff;">of</span> oDlg ;<br /> <span style="color: #0000ff;">UPDATE</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBTN1 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">113</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>nTYPE = <span style="color: #000000;">1</span>, zFREQUENCY := oRsDep:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FREQUENCY"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>, <span style="color: #000000;">)</span>, ;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>nTYPE = <span style="color: #000000;">1</span>, zFREQUENCYEID := oRsDep:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FREQUENCYEID"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>, <span style="color: #000000;">)</span>,;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>nTYPE = <span style="color: #000000;">2</span>, zT_FREQ := oRsDep:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FREQUENCY"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>, <span style="color: #000000;">)</span>, ;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>nTYPE = <span style="color: #000000;">2</span>, zT_FREQEID := oRsDep:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FREQUENCYEID"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>, <span style="color: #000000;">)</span>,;<br /> lOK2 := .T.,;<br /> oOBJ:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> oLbx:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBTN2 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">112</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lOK2 := .F., oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBTN3 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">114</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> _FreqView<span style="color: #000000;">(</span><span style="color: #ff0000;">"A"</span>, oRsDep <span style="color: #000000;">)</span>, ; <span style="color: #B900B9;">// depview.prg</span><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>, ,oLBX:<span style="color: #000000;">bLogicLen</span> := <span style="color: #000000;">{</span> || oRsDep:<span style="color: #000000;">RecordCount</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>, ,oLBX:<span style="color: #000000;">bGoTop</span> := <span style="color: #000000;">{</span> || oRsDep:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>, ,oLBX:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">{</span> || oRsDep:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>, ,oLBX:<span style="color: #000000;">bSkip</span> := <span style="color: #000000;">{</span> | nSkip | Skipper<span style="color: #000000;">(</span> oRsDep, nSkip <span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>oRsDep:<span style="color: #000000;">eof</span>, ,oLBX:<span style="color: #000000;">cAlias</span> := <span style="color: #ff0000;">"ARRAY"</span><span style="color: #000000;">)</span>,;<br /> oLBX:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,;<br /> oLBX:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,;<br /> SysReFresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> .not. oRsDep:<span style="color: #000000;">eof</span><br /> oLbx:<span style="color: #000000;">bLogicLen</span> := <span style="color: #000000;">{</span> || oRsDEP:<span style="color: #000000;">RecordCount</span> <span style="color: #000000;">}</span><br /> oLbx:<span style="color: #000000;">bGoTop</span> := <span style="color: #000000;">{</span> || oRsDEP:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oLbx:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">{</span> || oRsDEP:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oLbx:<span style="color: #000000;">bSkip</span> := <span style="color: #000000;">{</span> | nSkip | Skipper<span style="color: #000000;">(</span> oRsDEP, nSkip <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oLbx:<span style="color: #000000;">cAlias</span> := <span style="color: #ff0000;">"ARRAY"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> xSUPER = <span style="color: #ff0000;">'Y'</span>, ,oBtn3:<span style="color: #000000;">Hide</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br />oRsDEP:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> lOK2 = .F.<br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> nTYPE = <span style="color: #000000;">1</span><br /> zFREQUENCY := SPACE<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span><br /> zFREQUENCYEID := <span style="color: #ff0000;">"BOGUS"</span><br /> <span style="color: #00C800;">CASE</span> nTYPE = <span style="color: #000000;">2</span><br /> zT_FREQ := SPACE<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span><br /> zT_FREQEID := <span style="color: #ff0000;">"BOGUS"</span><br /> <span style="color: #00C800;">ENDCASE</span><br /> oOBJ:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />SysReFresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//-------------------------------</span><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SKIPPER<span style="color: #000000;">(</span> oRsx, nSkip <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> nRec := oRsx:<span style="color: #000000;">AbsolutePosition</span><br /><br />oRsx:<span style="color: #0000ff;">Move</span><span style="color: #000000;">(</span> nSkip <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">EOF</span>; oRsx:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>; <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">BOF</span>; oRsx:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>; <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> oRsx:<span style="color: #000000;">AbsolutePosition</span> - nRec <span style="color: #000000;">)</span><br /><br /> </div>[/code:2bcdgsln] |
Client Server options | Hi Carles,
Thanks for reply.
[quote:1j96hqjd]Can you use your ADS in xBrowse as an RDD more? Of course your can do it, but I do not think is the best way. I think the best is to create query, load and manage data in internal tables, and finally to work in some browse, no matter wich of them.[/quote:1j96hqjd]
So that´s that does my code but the performance is not as good as TDolphin.
Maybe I miss something?.
Rick, thank you about ADO. I will check it.
Thanks. |
Client Server options | Hi,
Can you use your ADS in xBrowse as an RDD more? Of course your can do it, but I do not think is the best way. I think the best is to create query, load and manage data in internal tables, and finally to work in some browse, no matter wich of them. Then modify all records processed. It is a system change, but ultimately offset by the performance.
This is the philosophy SQL, and it's true that you can work also as a RDD, but I think it is the best solution.
You too can handle data with typical command of xBase (skip, goTop, ...) join with SQL commands and this does not alter the way we work, but maybe you need to change the way to do with the browser, no matter which of them.
Just my humble opinion <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Client Server options | Reinaldo,
Here is a working sample:
[code=fw:3gjfoa5h]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Harbour Advantage RDD sample</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ads.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><br />Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo, AdsGetRelKeyPos, AdsSetRelKeyPos<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span>, cDbf, i<br /><br /> <span style="color: #00C800;">local</span> nInicio, nFinal<br /><br /> <span style="color: #00C800;">local</span> lCopy := .F.<br /><br /><br /><br /> <span style="color: #B900B9;">// Driver CDX----------------------------------------------------------------</span><br /> REQUEST DBFCDX, DBFFPT<br /><br /><br /> RddRegister<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADS"</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADS"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//setting up server type</span><br /> <span style="color: #B900B9;">// 1 = Local Server (no client / server)</span><br /> <span style="color: #B900B9;">// 2 = Remote Server</span><br /> <span style="color: #B900B9;">// 3 = Local + Remot</span><br /> <span style="color: #B900B9;">// 4 = Internet Server</span><br /> <span style="color: #B900B9;">// 5 = Local + Internet</span><br /> <span style="color: #B900B9;">// 6 = Remote+Internet</span><br /> <span style="color: #B900B9;">// 7 = Local + Remote + Internet , best choice</span><br /> adsSetServerType<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// ó adsSetServerType( ADS_REMOTE_SERVER )</span><br /><br /> <span style="color: #B900B9;">//setting up the file types</span><br /> <span style="color: #B900B9;">// 1 = DBFNTX</span><br /> <span style="color: #B900B9;">// 2 = DBFCDX</span><br /> <span style="color: #B900B9;">// 3 = ADSADI</span><br /> adsSetFileType<span style="color: #000000;">(</span> ADS_CDX <span style="color: #000000;">)</span> <span style="color: #B900B9;">// o ADS_CDX</span><br /><br /> AdsRightsCheck<span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <span style="color: #00C800;">IF</span> AdsConnect60<span style="color: #000000;">(</span> <span style="color: #ff0000;">"<span style="color: #000000;">\\</span>189.228.227.218:2000<span style="color: #000000;">\c</span>ursos<span style="color: #000000;">\a</span>dsdemo<span style="color: #000000;">\c</span>ibconwn<span style="color: #000000;">\s</span>tc<span style="color: #000000;">\i</span>nternet.add"</span>, <span style="color: #000000;">4</span>,<span style="color: #ff0000;">"demo"</span>,<span style="color: #ff0000;">"demo"</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Esta ahora conectado al Sevidor AIS de Cibertec en Mexico "</span>+CRLF+CRLF+;<br /> <span style="color: #ff0000;">"You are now connected to AIS Server"</span>,<span style="color: #ff0000;">"Bienvenido / Welcome / Versión "</span>+ADSVersion<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Se ha rechazado la conexión al servidor AIS, por favor intente mas tarde"</span>+CRLF+CRLF+;<br /> <span style="color: #ff0000;">"Conection to AIS Server rejected, please, try again later"</span>,<span style="color: #ff0000;">"AIS Error"</span><span style="color: #000000;">)</span><br /> QUIT<br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /><br /><br /> USE CATCUE SHARED <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"DATOS"</span><br /> DATOS-><span style="color: #000000;">(</span>AdsCacheRecords<span style="color: #000000;">(</span><span style="color: #000000;">50</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>OrdSetFocus<span style="color: #000000;">(</span><span style="color: #ff0000;">"NUMCUENTA"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>DBGOTOP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /> sysrefresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /><br /><br /> nInicio := seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> aArray := FW_DbfToArray<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> nfinal := seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> msgalert<span style="color: #000000;">(</span>nFinal-nInicio, <span style="color: #ff0000;">" DURACION de carga Array "</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /><br /><br /><br /> nInicio := seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> COPY <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"RENE.DBF"</span> VIA <span style="color: #ff0000;">"DBFCDX"</span><br /><br /> nfinal := seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> msgalert<span style="color: #000000;">(</span>nFinal-nInicio, <span style="color: #ff0000;">" TIME CopyTable "</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /> XBROWSER aArray<br /><br /> dbcloseall<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> quit<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span></div>[/code:3gjfoa5h]
It takes up to 10 seconds to load into the Array or copy file.
It is not very good performance.
Any clue?.
Thanks |
Client Server options | So, you're bringing a whole .dbf across the wire and you are asking why is it slow? Don't bring a whole table across the wire. That's the easy answer. The question should be, why are you bringing a whole .dbf table across the wire? The speed at which a table comes across a wire, depends on the speed of the wire.
I don't know what problem you are trying to solve. Maybe you need synchronized local copies of a remote table, if so then maybe you should read about ADS replication.
Again, so far everything I see from your code does not show a problem with AIS. It only shows a problem with what you are trying to do with it. I'm sorry I can't help you.
Best regards,
Reinaldo. |
Client Server options | Reinaldo,
I need to browse the full table. That´s what my software does and my customer except. I can´t just eliminate the browse to solve the problem.
I tested with ADS in two samples posted -last one using COPY TO LOCAL VIA "DBFCDX" and AdsCreateSQL...-. In both cases, the performance is very very bad. Maybe I am losing a third way.
Also, my settings in ADS.INI are (thanks to Francis advice):
[Settings]
COMPRESSION = Always
USE_TCP_IP = 1
PACKET_SIZE = 1024 //;or 1024 O 512
Without them, it takes 2 seconds more to accomplish the task.
But with Daniel´s TDolphin I can browse the full table almost [u:2nlyc370][b:2nlyc370]inmediate [/b:2nlyc370][/u:2nlyc370](yes, the full table over the wire!!!).
So the real point is that there is an important problem with performance with ADS and Harbour. This is the real point. |
Client Server options | lucas si usa sql en ads intenta realizar la instruccion pidiendo un cursos estatico el cual te muestra los datos inmediato
ejemplo
[code=fw:11d9i7ys]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">select</span> <span style="color: #000000;">{</span><span style="color: #00C800;">static</span><span style="color: #000000;">}</span> codigo, nombre <span style="color: #0000ff;">from</span> clientes<br /> </div>[/code:11d9i7ys]
cuando no se agrega {static} el cursor enviado por l servidor esta vivo y este toma mas tiempo mostrarse en un browse.
salu2
carlos vargas |
Client Server options | Carlos,
Many thanks.
With your great tip, I noticed an important increase of speed. Very very good.
Now the performance is much better with xBrowse.
But it also takes up to 30 seconds to load the table into the array. If I load the table in local mode the process takes 0.5 segs. |
Client Server options | Carlos,
Y en mi ejemplo, si necesito refrescar los datos del DBF temporal creado por ADS con el resultado de la consulta, ¿debo repetir la operación o hay algo parecido a un Refresh() del ADSExecuteSQLDirect( cSql )?.
Muchas gracias.
[code=fw:1xgx4ool]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> Test_SQL<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cSql := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cAlias := <span style="color: #0000ff;">Alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #B900B9;">/*al inicio de la instruccion sql se define un area vacia*/</span><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">/*se define instruccion sql en una cadena de texto*/</span><br /> cSql := <span style="color: #ff0000;">"SELECT {static} * FROM CUSTOMER"</span><br /> <span style="color: #0000ff;">msgINFO</span><span style="color: #000000;">(</span>csql, <span style="color: #ff0000;">"cSql"</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">/*crea instruccion sql y pasa los datos a tabla temporal*/</span><br /> ADSCreateSQLStatement<span style="color: #000000;">(</span> <span style="color: #ff0000;">"REPTMP"</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> ADSExecuteSQLDirect<span style="color: #000000;">(</span> cSql <span style="color: #000000;">)</span><br /><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #ff0000;">"REPTMP"</span><span style="color: #000000;">)</span><br /><br /> REPTMP-><span style="color: #000000;">(</span> DBGoTop<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> LastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> > <span style="color: #000000;">0</span> <span style="color: #B900B9;">// !REPTMP->( Eof() )</span><br /><br /> <span style="color: #B900B9;">/*lista resultado en tabla*/</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//aArray := FW_DbfToArray()</span><br /> <span style="color: #B900B9;">//XBROWSER aArray</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #B900B9;">/*no se encontro datos que cumpla condicion sql*/</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"No se ha encontrado REGISTROS"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*cierra tabla de datos temporal*/</span><br /> REPTMP-><span style="color: #000000;">(</span> DBCloseArea<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> Alert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"AdsExecuteSQLDirect() failed with error "</span>+ Str<span style="color: #000000;">(</span> ADSGetLastError<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /><br /> <span style="color: #B900B9;">/*se selecciona area de datos anterior*/</span><br /> <span style="color: #00C800;">IF</span> !Empty<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> DBSelectArea<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*da foco al browse*/</span><br /><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:1xgx4ool] |
Client Server options | Hola,
en ese caso, no creo que un cursor se pueda actualizar, salvo que lo vuelvas a crear, entonces para tu fin podrías intentar crear una tabla temporal en lugar de un cursos, me imagino que el tiempo de creación debería ser similar al del cursor.
Para actualizarla, no le veo complicado actualizar los registros modificados o los nuevos registros, esto lo puedes hacer bajo demanda, temporizado o utilizando las notificaciones de ADS ( habrá gente que sabrá como implementarlas en xHarbour, yo no lo hice), para estas cosas puedes utilizar MERGE, ahora para las eliminaciones puede que con triggers sea una opción.
Yo creo que este mismo problema tienes con tDolphin, salvo como tu dices las consultas con el son mucho mas rápidas por lo que no habría problema de reconsultar todo para refrescar la información
Son solo ideas, haber si nos comentas que haces
saludos
Marcelo |
Client Server options | I would think that to browse a remote table over an internet connection you would have to browse an SQL result sets with pagination (regardless of the sql engine). Lucas thinks he is bringing a whole table over the wire with Tdolphin, but I doubt so. That would be slow no matter the sql engine being used. I'm guessing that TDolphin is suppling result pages to xbrowse via the SetDolphin() method in xBrowse. This makes xBrowse smart enough to browse sql result sets from tdolphin.
xBrowse does not have a special method to do the same with an ADS sql result set. It might be a good idea for the fw community to add a method to xBrowse to enable browsing an ADS SQL result set, **but** before SetAds() method can be added to xbrowse, we would need to have a tAdsQuery() class to take care of methods, Gotop(), GoBottom(), Bof(), Eof(), LastRec(), RecNo(), Goto(), FieldPos(), FieldName(), FieldLen(), FieldDec, PrevPage() and NexPage() with pagination from an ADS sql query.
If we can recruit someone (Mr. Rao?) to work with the xbrowse part, then I would help with the TAdsQuery class. Again, adding SetAds() method to the xbrowse class would only be useful when xbrowsing tables over an internet connection from a fw/harb app.
Reinaldo. |
Client Server options | Hi friends,
First of all, I want to thank you all your help and valuable tips. We have narrowed the problem and we are very close to solve it. Remember, all except browsing features work fine with AIS over internet, with very few changes in code. This is very important and very reliable solution, with much more advantages than using Terminal Server.
Also, I want to thank Antonio for mantaining this strong and very helpfull community.
This is the sample with Carlos tip. The performance is much better than before:
[code=fw:2obm9be4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Harbour Advantage RDD sample</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ads.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><br />Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo, AdsGetRelKeyPos, AdsSetRelKeyPos<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span>, cDbf, i<br /><br /> <span style="color: #00C800;">local</span> nInicio, nFinal<br /><br /> <span style="color: #00C800;">local</span> lCopy := .F.<br /><br /><br /><br /> <span style="color: #B900B9;">// Driver CDX----------------------------------------------------------------</span><br /> REQUEST DBFCDX, DBFFPT<br /><br /><br /> RddRegister<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADS"</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADS"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//setting up server type</span><br /> <span style="color: #B900B9;">// 1 = Local Server (no client / server)</span><br /> <span style="color: #B900B9;">// 2 = Remote Server</span><br /> <span style="color: #B900B9;">// 3 = Local + Remot</span><br /> <span style="color: #B900B9;">// 4 = Internet Server</span><br /> <span style="color: #B900B9;">// 5 = Local + Internet</span><br /> <span style="color: #B900B9;">// 6 = Remote+Internet</span><br /> <span style="color: #B900B9;">// 7 = Local + Remote + Internet , best choice</span><br /> adsSetServerType<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// ó adsSetServerType( ADS_REMOTE_SERVER )</span><br /><br /> <span style="color: #B900B9;">//setting up the file types</span><br /> <span style="color: #B900B9;">// 1 = DBFNTX</span><br /> <span style="color: #B900B9;">// 2 = DBFCDX</span><br /> <span style="color: #B900B9;">// 3 = ADSADI</span><br /> adsSetFileType<span style="color: #000000;">(</span> ADS_CDX <span style="color: #000000;">)</span> <span style="color: #B900B9;">// o ADS_CDX</span><br /><br /> AdsRightsCheck<span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <span style="color: #00C800;">IF</span> AdsConnect60<span style="color: #000000;">(</span> <span style="color: #ff0000;">"<span style="color: #000000;">\\</span>c i b er-tec.d2g.com:2000<span style="color: #000000;">\c</span>ursos<span style="color: #000000;">\a</span>dsdemo<span style="color: #000000;">\c</span>ibconwn<span style="color: #000000;">\s</span>tc<span style="color: #000000;">\i</span>nternet.add"</span>, <span style="color: #000000;">4</span>,<span style="color: #ff0000;">"demo"</span>,<span style="color: #ff0000;">"demo"</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Esta ahora conectado al Sevidor AIS de Cibertec en Mexico "</span>+CRLF+CRLF+;<br /> <span style="color: #ff0000;">"You are now connected to AIS Server"</span>,<span style="color: #ff0000;">"Bienvenido / Welcome / Versión "</span>+ADSVersion<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Se ha rechazado la conexión al servidor AIS, por favor intente mas tarde"</span>+CRLF+CRLF+;<br /> <span style="color: #ff0000;">"Conection to AIS Server rejected, please, try again later"</span>,<span style="color: #ff0000;">"AIS Error"</span><span style="color: #000000;">)</span><br /> QUIT<br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /><br /><br /><br /><br /> USE CATCUE SHARED <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"DATOS"</span><br /> DATOS-><span style="color: #000000;">(</span>AdsCacheRecords<span style="color: #000000;">(</span><span style="color: #000000;">50</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>OrdSetFocus<span style="color: #000000;">(</span><span style="color: #ff0000;">"NUMCUENTA"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>DBGOTOP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /> sysrefresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> Test_SQL<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> DBCLOSEALL<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> QUIT<br /><br /><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><br /><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><br /><br /><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">function</span> Test_SQL<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cSql := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cAlias := <span style="color: #0000ff;">Alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> nInicio, nFinal<br /><br /><br /><br /><br /><br /> <span style="color: #B900B9;">/*al inicio de la instruccion sql se define un area vacia*/</span><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">/*se define instruccion sql en una cadena de texto*/</span><br /> <span style="color: #B900B9;">//cSql := "SELECT * FROM BIBLIO ORDER BY TITULO"</span><br /> cSql := <span style="color: #ff0000;">"SELECT {static} * FROM CATCUE ORDER BY DESCRIPCIO"</span><br /><br /> <span style="color: #0000ff;">msgINFO</span><span style="color: #000000;">(</span>csql, <span style="color: #ff0000;">"cSql"</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #B900B9;">/*crea instruccion sql y pasa los datos a tabla temporal*/</span><br /> ADSCreateSQLStatement<span style="color: #000000;">(</span> <span style="color: #ff0000;">"REPTMP"</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> ADSExecuteSQLDirect<span style="color: #000000;">(</span> cSql <span style="color: #000000;">)</span><br /><br /> DBSelectArea<span style="color: #000000;">(</span><span style="color: #ff0000;">"REPTMP"</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> LastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> > <span style="color: #000000;">0</span> <span style="color: #B900B9;">// !REPTMP->( Eof() )</span><br /><br /> <span style="color: #B900B9;">/*lista resultado en tabla*/</span><br /> <br /> dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #B900B9;">/*no se encontro datos que cumpla condicion sql*/</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"No se ha encontrado REGISTROS"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*cierra tabla de datos temporal*/</span><br /> REPTMP-><span style="color: #000000;">(</span> DBCloseArea<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> Alert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"AdsExecuteSQLDirect() failed with error "</span>+ Str<span style="color: #000000;">(</span> ADSGetLastError<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /><br /> <span style="color: #B900B9;">/*se selecciona area de datos anterior*/</span><br /> <span style="color: #00C800;">IF</span> !Empty<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> DBSelectArea<span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/*da foco al browse*/</span><br /><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:2obm9be4]
Hope Mr. Nages and Daniel could help us with xBrowse. In this case, we will build a very easy way to enable cliente/server to our software with very very little changes.
Thanks again for this very instructive debate. |
Client Server options | Lucas;
It is not going to change speed of the SQL cursor xbrowsing, but I think you can save these lines as they are not doing anything. You don't need to open the table when using SQL.
[code=fw:1so9utd9]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//the lines below are not doing anything.</span><br /><br />USE CATCUE SHARED <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"DATOS"</span><br /> DATOS-><span style="color: #000000;">(</span>AdsCacheRecords<span style="color: #000000;">(</span><span style="color: #000000;">50</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>OrdSetFocus<span style="color: #000000;">(</span><span style="color: #ff0000;">"NUMCUENTA"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> DATOS-><span style="color: #000000;">(</span>DBGOTOP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /> sysrefresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:1so9utd9]
Reinaldo. |
Client Server options | Thank you.
I have them as I did other tests, such as append blank, locate, etc which are working very well.
Do you think any way to update/refresh the cursor?. It is not a handicap, as I can always repeat the query.
Thanks again. |
Client Server options | A static cursor a new table based on the old table (or tables). It is not refreshed when the base table changes. What you want is a Dynamic cursor (remove the {static} clause). A Dynamic cursor is actually faster than a static cursor. The problem is that xBrowse requests the full result set every time you move. If xbrowse was fixed to be used with ADS, then a dynamic (live) cursor would be much faster to xbrowse.
Here is the difference between a live (also called dynamic) cursor vs a static cursor from the help file:
[quote:2g8h8kmj]
A live cursor is constructed by essentially putting a filter on the base table so that only the requested rows are visible. Conversely, a static cursor is actually a new table dynamically built with the requested rows of the original table or tables. Because the live cursor does not move any records around, it is faster to retrieve as a rowset. However, a static cursor is not completely populated when it is created.
A form of "caching" is used to add a certain number of rows at a time to the static cursor, so that control is returned to client in a reasonable time. The static cursor is populated as the rowset is traversed. This results in a more immediate response to the query, and processing is not wasted if only the first portion of the rowset is traversed. Note that the following operations will cause the static cursor rowset to be fully populated: Last (or Go Bottom), RecCount, Create Index.
For either live or static cursors, a cursor handle is utilized in a manner analogous to a table handle. This cursor handle can be used to navigate the resulting cursor in a fully scrollable manner. For all intents and purposes, the cursor can be treated like a table. Static cursors cannot be modified, but modifications on live cursors are reflected in the source table.
A live cursor can be much faster than a static cursor. However, this performance difference has a trade-off against features that can only be used on a static cursor. A live cursor is used if the SELECT statement does not contain any of the following:
· • DISTINCT in the SELECT clause
· • Joins (inner, outer, self, or UNION)
· • Any aggregate function
· • GROUP BY or HAVING clauses
· • Subqueries
· • Certain scalar functions (see Scalar Functions in a WHERE Clause)
· • If a memo field is used in a WHERE clause (e.g., WHERE memo is null)
· • LIKE operator is used in a WHERE clause (e.g.,. WHERE lastname LIKE 'Smith%)
· • Expressions or scalar functions in the select list (e.g., select UCASE(lastname) … )
· • TOP in the SELECT clause
· • WHERE clause contains a large expression that is not supported by the expression engine
It is possible to force Advantage to produce a static cursor on a SELECT statement that would normally result in a live cursor. To do this, use the {static} escape sequence after the SELECT keyword. For example:
SELECT {static} * FROM emp WHERE hire_date < '1990-01-14'
Without the escape sequence, Advantage would create a live cursor for that query. With {static} specified, though, Advantage will create a static cursor. From a performance standpoint, it is probably better in most circumstances to allow Advantage to create live cursors when possible.
If, though, the WHERE clause is very restrictive (thus producing a small rowset) and the base table is very large, it may be faster to force a static cursor. This is because the live cursor would be implemented with a filter on the server. If the client application were to traverse the rowset multiple times, the server would have to filter the rowset each time. If the client forced the cursor to be static, however, the server may be able to quickly seek directly to the data for the rowset with minimal cost. And once the cursor is created, the server would not be required to do any filtering when the client traversed the rowset.
See Also
Cursor Types
[/quote:2g8h8kmj]
Reinaldo. |
Client Server options | Here is a good explanation of the difference between a live cursor and a static cursor from the help file:
[quote:3ml0rkwq]
Cursors are produced by executing SQL SELECT statements. Technically, a cursor is considered to be the mechanism by which the results of a query are manipulated and traversed. More generally, however, a cursor is often equated with the rowset itself. Cursors produced by Advantage are either live or static.
An Advantage live cursor represents a dynamic, server-side, scrollable cursor. With live (dynamic) cursors, updates to the base table are reflected in the cursor. For example, consider "select * from employee where lastname = ‘Smith’". If a record is appended to the employee table and the new record’s lastname field is set to ‘Smith’, that new record will be inserted into the cursor. Likewise, an update will remove a record from the cursor if the lastname field is changed.
Advantage static cursors cannot be updated, nor are updates to the base tables of a static cursor reflected in the cursor itself. An example of a query that results in a static cursor is "select * from orders, customers where order.custid = customers.custid." Once the rowset produced by that query is fully populated, updates to the orders and customers tables will have no effect on the cursor.
It is important to note that there are two specific cases where table updates made by one user are not reflected in another user's dynamic cursor. Advantage Local Server does not automatically detect changes in tables that are made by other clients. This means that updates made by applications using Advantage Local Server are propagated only to cursors owned by that same application. Similarly, another situation where updates are not reflected in live cursors is with Advantage Database Server when it uses the compatibility locking mode in order to share DBF tables with third-party applications. If a third-party application updates a table, the Advantage Database Server does not automatically detect that update and, therefore, it will not update cursors based on that table.
[/quote:3ml0rkwq]
Reinaldo. |
Client Server options | el culpable de la lentitud en los browse es la funcion ordkeycount, la cual para obtener su valor de retorno tiene que recorrer todo el cursor.
y para remate el bloque de codigo bkeyCount en xbrowse que es el responsable de obtener el valor de cuantos registros tiene el browse, se ejecuta cada tanto.
haciendo la presentacion de un browse extremadamente lenta.
es por ello que en los grid de delphi, de forma estandar el scrollbar vertical no es funcional completamente, solo funciona el movimiento hacia el inicio y hacia el final.
(TOP y BOTTOM) y el thumbnail esta siempre al centro, no funciona desplazar el thumbnal hacia arriba o abajo. (SKIP 1 o SKIP -1) esto para no estar calculando la posicion relativa del cursor y posicionar el thumbnail en la posicion correcta, ya que para hacer esto necesitaria estar costantemente calculando cuantos registros hay (llamando a adskeycount por supuesto) y cualcular la pos relativa, esto es por lo cual los grid en delphi dan la apariencia de ser rapidos con ads, la verdad es que para ambientes cliente servidor la funcion adskeycount se debe evitar como a la peste bubonica.
lo que habria que hacer es modificar los browse de fwh para que tengan el comportamiento similar al de delphi.
esto lo he deducido viendo arc, y un poco con el poco ingles que entiendo leyendo el help de ads.
asi que no es una ley que aparecio en la biblia. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->, puedo estar muy equivocado.
salu2
carlos vargas |
Client Server options | Carlos;
Excellent remarks. I couldn't agree more.
Reinaldo. |
Client Server options | Carlos,
[quote:3jk3v8zz]el culpable de la lentitud en los browse es la funcion ordkeycount...[/quote:3jk3v8zz]
Esto entre otras cosas, por eso recomiendo carga en tabla y despues tratarlo. Lo que has exlicado, tan facil de entender imaginate en una conexion Inet... Los browsers actuales constantemente hacen peticiones al server, para conocer posiciones, num reg., ... y como no hay un sistema de paginacion local, o un mejor acceso a los datos por eso penaliza con lentitud. |
Client Server options | Hello,
What does the Fivetech team think about this changes?.
Thank you. |
Client Server options | Up.
Thanks. I think it is very importat for the future!!. |
Client to Screen | We often find this kind of correction to the coordinates returned by ClientToScreen and SceenToClient functions
[code:26abxwfj]
aPoint = ClientToScreen( ::hWnd, aPoint )
if aPoint[ 1 ] > 32768
aPoint[ 1 ] -= 65535
endif
if aPoint[ 2 ] > 32768
aPoint[ 2 ] -= 65535
endif
[/code:26abxwfj]
It is also advised in these forums to use the correction after call to these functions. Why can't the correction be built into the FWH functions ClientToScreen and SceenToClient, so that we do not have to write the extra repetitive code ? Incorporating these corrections in the main code does not break any existing code. |
Client to Screen | NageswaraRao,
In those circunstances we need a "short" (16 bits) signed value from PRG level.
Maybe we could try to change:
[code:1ughci7h]
hb_reta( 2 );
hb_stornl( pt.x, -1, 2 );
hb_stornl( pt.y, -1, 1 )
[/code:1ughci7h]
into:
[code:1ughci7h]
hb_reta( 2 );
hb_storni( ( short int ) pt.x, -1, 2 );
hb_storni( ( short int ) pt.y, -1, 1 )
[/code:1ughci7h] |
Cliente / Servidor | Hola Foro:
Necesito iniciarme en esta estructura. ¿Sabeis de un sitio donde me propongan ejemplos, herramientas a utilizar, etc. . . ? Me han comentado Mysql, advantage, pero no se por donde empezar. Tambien he intentado configurar el advantage en una pequeña red de area local, pero que va, tengo algunas lagunas que me hacen NO poder avanzar. Como siempre agradecería un ejemplo por muy pequeño que fuera, que luego ya me encargo yo. UN SALUDO y muchas gracias. |
Cliente / Servidor | Antes de hacer el ejemplo con el cliente, tienes que tener instalado el servidor, asi que si nos puedes plantear tus dudas con los servidores, con gusto te ayudamos.
Lo del cliente viene despues, primero tenemos que instalar el servidor. |
Cliente / Servidor | Gracias Rene por tu respuesta:
Quiero empezar de cero, y habiendo leido post tuyos e incluso enlaces que has puesto sobre el servidor que montaste en Mexico junto con los resultados de conexiones etc. . . , creo que la solución de advantage es muy buena, pero primero necesitaria saber qué es lo que tengo que instalar en el servidor. Se que a lo mejor es tedioso lo que te estoy planteando, pero ¿algun manual, alguna web donde descargar versiónes demo para 1 usuario?
MUCHAS GRACIAS!! |
Cliente / Servidor | pues mira en mi poca experiencia con advantage te puedo decir que es una excelente solucion ademas la migracion de tus aplicaciones FW16, CLIPPER y FW32 para trabajar bajo el cliente/servidor realmente es de risa (claro que con el apoyo de gente como Rene todo es facil <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> ) , que necesitas en tu servidor pues de hardware realmente no mucho un pentium v normalito es suficiente, y pues depende del sistema operativo tienes varias versiones de advantage, la instalacion del servidor advantage es realmente sencilla sin rollos solo windows 2003 da un que otro problemilla para levantar el servicio pero solucionable... lo de las versiones de prueba pues talvez rene te pueda ayudar...
saludos |
Cliente / Servidor | Hola....
Yo te aconsejo MySQL, es facil de aprender no es del todo gratis, pero puedes empezar sin gastar casi ni un centavo.
Ademas puedes enlazar varios puntos de trabajo por medio de internet sin costo solo tu linea de internet, si necesitas algo referente a MySQL por aqui estamos.
Saludos
Marco A. Delgado. |
Cliente / Servidor | [quote="Marco A. Delgado":ejnmo8lj]Hola....
Yo te aconsejo MySQL, es facil de aprender no es del todo gratis, pero puedes empezar sin gastar casi ni un centavo.
Ademas puedes enlazar varios puntos de trabajo por medio de internet sin costo solo tu linea de internet, si necesitas algo referente a MySQL por aqui estamos.
[/quote:ejnmo8lj]
Mejor, te pones un PostGre, muchisimo mas potente, y encima libre.
Total, la sintaxis viene a ser mas o menos la misma.
Sobre ADS, demasiado CARO, eso si, para seguir tu forma de trabajar
con tus RDDs, es lo mas rapido.
Pero entre todos, PostGre sin dudas, posiblemente, el mejor de estas
3 opciones.
( ...Pues a mi no me gusta.... - Bueno, dije posiblemente <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) --> )
Saludos
Rafa Carmona |
Cliente / Servidor | Rafa, algunas veces tienes razón <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
Voto tambien por Postgresql, es muy potente, y es totalmente gratuito, es muy estable y seguro.
Saludos |
Cliente / Servidor | [quote="thefull":3jglxb92][quote="Marco A. Delgado":3jglxb92]Hola....
Yo te aconsejo MySQL, es facil de aprender no es del todo gratis, pero puedes empezar sin gastar casi ni un centavo.
Ademas puedes enlazar varios puntos de trabajo por medio de internet sin costo solo tu linea de internet, si necesitas algo referente a MySQL por aqui estamos.
[/quote:3jglxb92]
Mejor, te pones un PostGre, muchisimo mas potente, y encima libre.
Total, la sintaxis viene a ser mas o menos la misma.
Sobre ADS, demasiado CARO, eso si, para seguir tu forma de trabajar
con tus RDDs, es lo mas rapido.
Pero entre todos, PostGre sin dudas, posiblemente, el mejor de estas
3 opciones.
( ...Pues a mi no me gusta.... - Bueno, dije posiblemente <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) --> )
Saludos
Rafa Carmona[/quote:3jglxb92]
Podrías postear algun ejemplo amigo?
Gracias. |
Cliente / Servidor | Rafa,
y EnterpriseDB <!-- m --><a class="postlink" href="http://www.enterprisedb.com/">http://www.enterprisedb.com/</a><!-- m --> ?
Saludos,
Félix |
Cliente / Servidor | Rafa,
y EnterpriseDB <!-- m --><a class="postlink" href="http://www.enterprisedb.com/">http://www.enterprisedb.com/</a><!-- m --> ?
Saludos,
Félix |
Cliente / Servidor | [quote="Baxajaun":3bour6k7]Rafa,
y EnterpriseDB <!-- m --><a class="postlink" href="http://www.enterprisedb.com/">http://www.enterprisedb.com/</a><!-- m --> ?
Saludos,
Félix[/quote:3bour6k7]
Felix, viendolo, creo que se basa en PostGre, por lo tanto, aceptamos
tambien a Enterprisedb como unos de los mejores <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
Personalmente, para APRENDER , contra MySql, es lo mas sencillo, porque no tiene ni la mitad de cosas que tiene el postgre , y eso que
te ahorras en aprender.
Ahora si, si tienes que meter alguna aplicacion buscando 'robustez',
hay que mirar hacia PostGre antes que MySql. |
Cliente / Servidor | [quote="goosfancito":2s7mobsg][quote="thefull":2s7mobsg][quote="Marco A. Delgado":2s7mobsg]Hola....
Yo te aconsejo MySQL, es facil de aprender no es del todo gratis, pero puedes empezar sin gastar casi ni un centavo.
Ademas puedes enlazar varios puntos de trabajo por medio de internet sin costo solo tu linea de internet, si necesitas algo referente a MySQL por aqui estamos.
[/quote:2s7mobsg]
Mejor, te pones un PostGre, muchisimo mas potente, y encima libre.
Total, la sintaxis viene a ser mas o menos la misma.
Sobre ADS, demasiado CARO, eso si, para seguir tu forma de trabajar
con tus RDDs, es lo mas rapido.
Pero entre todos, PostGre sin dudas, posiblemente, el mejor de estas
3 opciones.
( ...Pues a mi no me gusta.... - Bueno, dije posiblemente <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) --> )
Saludos
Rafa Carmona[/quote:2s7mobsg]
Podrías postear algun ejemplo amigo?
Gracias.[/quote:2s7mobsg]
Los ejemplos estan en /contrib/pgsql/tests.
De todas maneras, precisamente este fin de semana he estado jugando
y tiene varios bugs, que ya le he notificado a Rodrigo, autor del codigo. |
Cliente / Servidor | Hola...
Tambien podeis probar SqlServer con MSDE que es graito para 5 conexiones simultanes o Sql Server 2005 Express, tambien gratuito.
Saludos,
José Luis Capel |
Cliente / Servidor | .
. |
Cliente / Servidor | [quote="thefull"][quote="Baxajaun"]Rafa,
y EnterpriseDB <!-- m --><a class="postlink" href="http://www.enterprisedb.com/">http://www.enterprisedb.com/</a><!-- m --> ?
Saludos,
Félix[/quote]
Felix, viendolo, creo que se basa en PostGre, por lo tanto, aceptamos
tambien a Enterprisedb como unos de los mejores <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
Personalmente, para APRENDER , contra MySql, es lo mas sencillo, porque no tiene ni la mitad de cosas que tiene el postgre , y eso que
te ahorras en aprender.
Ahora si, si tienes que meter alguna aplicacion buscando 'robustez',
hay que mirar hacia PostGre antes que MySql.[/quote]
Rafa,
MySQL es muy estable, no tengo mucha experiencia con Postgres pero para que sea MÁs estable tiene que serlo pero mucho.
Que por ahí la licencia tan particular de MySQL te hace dejarlo de lado.. eso lo entiendo, pero hay cosas que no se le pueden discutir, y una es que es una de las más estables que hay.
Una cosa que siempre me gustó de MySQL erspecto del resto es la sencillez de la replicación, que en Postgres es bastante más compleja.
Otra cosa en la que me gusta más el MySQL es que los autoincrementales de Postgres necesitan que exista el sequencer para poder usarlos y no como MySQL que implementa el sequencer en la misma estructura de la BBDD.
Punto a favor de Postgres: la orientacion a objetos.
Un saludo,
Carlos |
Cliente FTP con FW+xH | Hola Gente... Buen Día a tod@s!!!
Feliz y Prospero 2012!!!
Tenia mucho tiempo si entrar al foro y veo muchos nombres nuevos, lo cual me dice mucho de la aceptación de FW por la comunidad de programadores...
Se me esta presentando una necesidad, nueva para mi, en la que necesito subir y bajar archivos de datos en un servidor FTP desde FW... Mirando los los fuentes veo que estan clases tFTP, tFTPCli, tFTPFile, tFTPServ, y tFTPSess; y en los ejemplos estan FTPDir y FTPServ...
Por lo pronto la cosa se me ha trancado porque me sale un dialogo que me dice "Cannot load WinINet.dll!"... buscando encontre que esa DLL es parte de Windows, se encuentra en la carpeta System32 de Windows... la copie a la carpeta donde estoy tratando de que el ejemplo corra, y aun asi no hay forma...
Me gustaria una orientación de parte de quienes hayan tenido alguna experiencia accediendo a un servidor FTP desde FW...
Agradezco de antemano cualquier tip/orientación/comentario al respecto...
Giancarlo J. Sabattino
Valencia, Venezuela |
Cliente FTP con FW+xH | Así hago yo para subir archivos a un ftp
//----------------------------------------------------------------------------//
Function FTPSendFiles( cFTPSite, aSource, aTarget, cUserFtp, cPassFtp )
Local lEnd := .f.
Local nBufSize := 2000
Local oInternet, oFTP
MsgRun( "Conectando al Sitio FTP...", "Espere...",;
{ || oInternet := TInternet():New(),;
If( Empty( oInternet:hSession ),;
MsgAlert( "Sin Conexión a Internet!" ),),;
oFTP := TFTP():New( cFTPSite, oInternet, Alltrim(cUserFtp),Alltrim(cPassFtp) ) } )
if Empty( oFTP:hFTP )
MsgStop( "Imposible Conectarse al Sito FTP!" )
return nil
endif
SendFiles( aSource, aTarget, nBufSize, lEnd, oFTP )
oInternet:End()
return nil
//----------------------------------------------------------------------------//
Static Function SendFiles( aSource, aTarget, nBufSize, lEnd, oFTP )
Local n
Local hSource
Local cBuffer := Space( nBufSize )
Local nBytes, nFile := 0, nTotal := 0
Local nTotSize := 0
Local oFile
for n = 1 to Len( aSource )
if ! File( aSource[ n ] )
MsgStop( "Archivo No Encontrado: " + aSource[ n ] )
exit
endif
hSource = FOpen( aSource[ n ] )
nTotSize += FSeek( hSource, 0, 2 )
FClose( hSource )
next
for n = 1 to Len( aSource )
hSource = FOpen( aSource[ n ] )
oFile = TFtpFile():New( aTarget[ n ], oFTP )
oFile:OpenWrite()
FSeek( hSource, 0, 0 )
nFile := 0
while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0 .and. ! lEnd
oFile:Write( SubStr( cBuffer, 1, nBytes ) )
end
FClose( hSource )
oFile:End()
if lEnd
exit
endif
next
Return nil
//----------------------------------------------------------------------------// |
Cliente FTP con FW+xH | Gracias por el ejemplo...
Lo copie tal cual, pero aun me sigue saliendo el dialogo con el mensaje "Cannot load WinINet.dll!"...
pero... dos maquinas tengan el mismo problema??
Seguire buscando, pero aun asi acepto mas tips/ejemplos/sugerencias/comentarios... |
Cliente FTP con FW+xH | Giancarlo,
¿Qué versión de FWH y de Harbour usas?.
Tiene pinta de que tienes una versión antigua... |
Cliente FTP con FW+xH | Esta solución me funciona perfecto..
viewtopic.php?f=6&t=20501&p=108900&hilit=JOHNSON+RUSSI#p108900
Johnson Russi
Colombia |
Cliente FTP con FW+xH | 1) Tienes que comenzar añadiendo en la cabecera los siguientes includes:
#include "Fivewin.ch"
#include "wininet.ch"
2) Escribe la siguiente funcion:
FUNCTION SubirFtp( cFtpAddress, cUser, cPass, cOrigen, cDestino, nPort, nService )
local hWinInet, hInternet, hConnect, lOk
// cargamos la DLL si no estaba cargada
hWinINet := WinINet()
if hWinINet < 0 .or. hWinINet >= 32
hInternet := InternetOpen( "Valdenebro", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
endif
hConnect := INTERNETCONNECT( hInternet, cFtpAddress, nPort, cUser, cPass, nService, 0, 0 )
IF hconnect == 0
ALERT ("ERROR EN CONEXION.",,"Descarga","X",,.t.)
ELSE
TRY
lOk := FTPPUTFILE( hConnect, cOrigen, cDestino, 0, 0 )
alert (lOk)
CATCH
ALERT ("Error FTP.",,"Descarga","X",,.t.)
END
ENDIF
INTERNETCLOSEHANDLE( hConnect )
INTERNETCLOSEHANDLE( hInternet )
RETURN nil
3) Llama a esa funcion desde cualquier parte de tu programa, sustituyendo las variables por las tuyas:
SubirFtp("ftp.xxxx.com",;
"nombreUsuarioFTP",;
"claveUsuarioFTP",;
"csv/pepe1.txt", ; // donde tienes el fichero origen
"/html/csv/pepe2.txt",; // donde quieres colocar en el servidor el fichero
21, 1 ) // 21 es el puerto FTP y 1 es el servicio
4) Si no te funciona, tómate un Redbull y prueba de nuevo. |
Cliente FTP con FW+xH | usando script:
[code=fw:2z4wy576]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />UploadFtp<span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\t</span>emp<span style="color: #000000;">\c</span>lientes.txt"</span><span style="color: #000000;">)</span><br />DownloadFtp<span style="color: #000000;">(</span><span style="color: #ff0000;">"clientes.txt"</span><span style="color: #000000;">)</span><br />DeleteFtp<span style="color: #000000;">(</span><span style="color: #ff0000;">"clientes.txt"</span><span style="color: #000000;">)</span><br /><br />*-----------------------------------------------------<br /><span style="color: #00C800;">Function</span> DownloadFtp<span style="color: #000000;">(</span>cFile<span style="color: #000000;">)</span><br /> oText=TTxtFile<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SeuLogin"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SuaSenha"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"binary"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"get /www/test/"</span>+cFile+<span style="color: #ff0000;">" c:<span style="color: #000000;">\c</span>lientes1.txt"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// pega o arquivo do ftp(pasta /www/test/) e grava no C: com o nome clientes1.txt </span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"bye"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"quit"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> MyRun<span style="color: #000000;">(</span><span style="color: #ff0000;">"ftp -s:c:<span style="color: #000000;">\s</span>cript.txt ftp.teste.net.br"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// seu servidor de ftp nessa linha</span><br /><br /> FERASE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br />*-----------------------------------------------------<br /><span style="color: #00C800;">Function</span> UploadFtp<span style="color: #000000;">(</span>cFile<span style="color: #000000;">)</span><br /> FERASE<span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span> <span style="color: #000000;">)</span><br /><br /> oText=TTxtFile<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SeuLogin"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SuaSenha"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"binary"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"cd /www/test"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//abri pasta para upload</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"put "</span>+cFile<span style="color: #000000;">)</span> <span style="color: #B900B9;">// envia o arquivo para para pasta aberta do ftp</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"bye"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"quit"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> MyRun<span style="color: #000000;">(</span><span style="color: #ff0000;">"ftp -s:c:<span style="color: #000000;">\s</span>cript.txt ftp.teste.net.br"</span><span style="color: #000000;">)</span><br /><br /> FERASE<span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br />*-----------------------------------------------------<br /><span style="color: #00C800;">Function</span> DeleteFtp<span style="color: #000000;">(</span>cFile<span style="color: #000000;">)</span><br /> oText=TTxtFile<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SeuLogin"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SuaSenha"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"binary"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"delete /www/test/"</span>+cFile<span style="color: #000000;">)</span> deleta o arquivo da pasta /www/test <span style="color: #00C800;">do</span> seu ftp<br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"bye"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"quit"</span><span style="color: #000000;">)</span><br /> oText:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> MyRun<span style="color: #000000;">(</span><span style="color: #ff0000;">"ftp -s:c:<span style="color: #000000;">\s</span>cript.txt ftp.teste.com.br"</span><span style="color: #000000;">)</span><br /><br /> FERASE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\s</span>cript.txt"</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------*--------------------------------</span><br /><span style="color: #00C800;">Function</span> MYRUN<span style="color: #000000;">(</span> cComando <span style="color: #000000;">)</span><br /><span style="color: #00C800;">Local</span> oShell, RET<br /><br /> oShell := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"WScript.Shell"</span> <span style="color: #000000;">)</span><br /> RET := oShell:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"%comspec% /c "</span> + cComando, <span style="color: #000000;">0</span>, .T. <span style="color: #000000;">)</span><br /> oShell := <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">Return</span> iif<span style="color: #000000;">(</span> RET = <span style="color: #000000;">0</span>, .T., .F. <span style="color: #000000;">)</span><br /><br /> </div>[/code:2z4wy576] |
Cliente FTP con FW+xH | Estimados, he encontrado que en las versiones recientes de fwh y xharbour, con harour no he probado
la funcion file esta fallando en ubicar archivos ubicados en la misma carpeta de la applicacion
esto luego de ocupar la instrucion set defa to
por ejemplo
[code=fw:31bdq0y5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />?file<span style="color: #000000;">(</span><span style="color: #ff0000;">"miapp.exe"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//aca retorna .t.</span><br />set defa <span style="color: #0000ff;">to</span> d:\miapp\datos<br />?file<span style="color: #000000;">(</span><span style="color: #ff0000;">"miapp.exe"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//aca retorna .f.</span><br />set path <span style="color: #0000ff;">to</span> <span style="color: #ff0000;">".<span style="color: #000000;">\"</span><br />?file("</span>miapp.exe<span style="color: #ff0000;">") //aca retorna .t.<br /></span></div>[/code:31bdq0y5] |
Cliente FTP con FW+xH | Gracias a todos por sus aportes...
Ciertamente mis versiones de xHarbour y de FW estaban algo desactualizadas, por lo que antes de intentar otras alternativas (incluidas algunas de las que me han sugerido en este hilo) decidi actualizar mis versiones de xH, FWH, y los sistemas que he desarrollado con esas herramientas.
Sin embargo, una vez estando actualizado me encontre que los ejemplos igual muestran el mensaje de error "Cannot load WinINet.dll!" lo cual aparentemente, y segun lo que he leido en otros hilos, se debe a algun problema de compatibilidad entre xH, FW y Windows, ya que aun teniendo la ultima version de WinINet.dll, y teniendo todos los paths bien direccionados se mantiene el problema de que no se carga la fulana DLL.
Veo que yo no he sido el unico al que se le ha presentado el problema, y las soluciones siguen siendo problematicas porque en la mayoría de los casos no funcionan, sin embargo di con un post de Enrico Maria Giordano donde plantea una solución que me funcionó perfecto y de hecho creo que es lo que a la final implementaré... <!-- m --><a class="postlink" href="http://fivetechsupport.com/forums/viewtopic.php?f=3&t=23075&p=123966&hilit=tftp#p123966">http://fivetechsupport.com/forums/viewt ... tp#p123966</a><!-- m -->
El tema de los scripts me parece interesante... no lo he probado, pero seguro que lo haré en lo que tenga algun rato libre...
Gracias a Todos por su apoyo y su granito de arena...
Un Abrazo y seguro los estaré molestando en alguna otra oportunidad.
Giancarlo J. Sabattino S.
Valencia, Venezuela |
Cliente Servidor. Como empezar. | Hola a todos,
A ver como se lo explico a ustedes.
Ya les anticipo que aun no gogleado sobre el tema, y que soy autodidacta, no diplomado.
Se me presenta la ocasión de crear una aplicación del lado Servidor. (El cliente pedirá mediante un WebService [que ya veré como lo toreo]).
La aplicación recibirá peticiones de hacer algo, contestar la respuesta y dar por acabada la pecitión; es decir lo que se haría sería del tipo "oye servidor, aquí tienes esta cadena, grábala en un fichero y dime el nombre del fichero que has grabado". No hay un diálogo de varios mensajes entre el cliente y el servidor.
Ahora les comento lo que me han explicado (no lo abré oído bien).
Van y me cuentan (una persona que en principio sabe mucho más que yo):
-cuando recibas la petición del cliente, vas y lanzas tu exe, que haga lo que deba, conteste al cliente y se cierre.
Y esto debe hacerlo para cada petición del cliente.
Y yo pienso, entonces si se da el caso de tener unas 10 peticiones concurrentes (para el caso concreto sería posible), habrán 10 exe ejecutándose.
Y yo les pregunto a ustedes del foro, esto es así? un Servidor se comporta de esta manera? No se utilizan multihilos? O algo parecido? El Servidor, no está escuchando y gestionando mensajes del tipo "ya te he oído, estoy saturado, espera un momento, ahora te atiendo, etc."?
Por favor láncenme algún comentario, o si puedo encontrar algo para ignorantes que me guie.
Para acabar, lo harían ustedes con Harbour? y con FiveWin y Harbour?
Saludos y gracias
Carlos G. |
Cliente Servidor. Como empezar. | Carlos,
A cuantos clientes tendria que atender, aproximadamente ? |
Cliente Servidor. Como empezar. | [quote="Antonio Linares":1y9pbg3f]Carlos,
A cuantos clientes tendria que atender, aproximadamente ?[/quote:1y9pbg3f]
Gracias Antonio,
Podrían llegar a ser unas 10 ó 15 en el mismo instante (concurrentes), y el trabajo que debería realizar el ejecutable podría tardar de 3 a 5 segundos; por tanto estamos hablando en el peor de los casos de un máximo de unas 60 peticiones ejecutándose en el mismo segundo.
Esta punta de trabajo no es constante, sino que se trataría del momento del día con más solicitud, teniéndose que ejecutar unas 2500 solicitudes de clientes diferentes en 20 minutos.
Lo conocido són las 2500 solicitudes i los 20 minutos, el resto es aproximado y buscando el límite.
Y estoy pensando en utilizar un control Activex para crear un documento en RTF (documento dinámico y bastante complicado por cierto).
Gracias de nuevo.
Carlos G. |
Cliente Servidor. Como empezar. | Carlos,
Doug ha desarrollado una aplicación cliente servidor por sockets bastante interesante:
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=12269&start=0">viewtopic.php?f=3&t=12269&start=0</a><!-- l -->
Posiblemente puedas usar su trabajo como referencia y punto de partida de lo que quieres hacer <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Contacta con él, que seguro te ayudará con la implementación <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Cliente Servidor. Como empezar. | [quote="Antonio Linares":1dphrrfj]Carlos,
Doug ha desarrollado una aplicación cliente servidor por sockets bastante interesante:
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=12269&start=0">viewtopic.php?f=3&t=12269&start=0</a><!-- l -->
Posiblemente puedas usar su trabajo como referencia y punto de partida de lo que quieres hacer <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Contacta con él, que seguro te ayudará con la implementación <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->[/quote:1dphrrfj]
Gracias Antonio,
Ya lo he leído, parece ser una especie de cliente-servidor personalizado y adaptable según necesidades.
La solución que plantea me gusta e intuyo que puede llegar a desencadenar 'loquesea' del lado servidor.
Por otro lado, no entiendo porque en sus primeros mensajes dice no quiere usar LeToDB si lo que persigue es trabajar sobre DBF (en otros posteriores dice que no entiende/le es dificil el 'C'); mi nivel de ingles es bajo.
Un saludo
Carlos G. |
Cliente Servidor. Como empezar. | Carlos,
Doug ha optado por construirse una solucion 100% suya, lo cual es muy interesante, pues podrias adaptarla a tus necesidades <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Cliente Servidor. Como empezar. | [quote="Antonio Linares":z0chq2lo]Carlos,
Doug ha optado por construirse una solucion 100% suya, lo cual es muy interesante, pues podrias adaptarla a tus necesidades <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->[/quote:z0chq2lo]
Gracias, la tendré en cuenta.
Un saludo
Carlos G. |
Cliente Telnet | Alguien tiene desarrollado algo con sockets para usar como cliente telnet. |
Cliente Telnet | Biel
You can try modify a FTP Class inputing de Telnet commands.
See this page with telnet commands explanation:
<!-- m --><a class="postlink" href="http://www.math.utah.edu/computing/unix/unix-commands.html">http://www.math.utah.edu/computing/unix ... mands.html</a><!-- m --> |
Cliente Telnet | Rochinha, thanks for your answer. I will take a look to the FTP class and the link you have sended. |
Cliente Telnet | Biel,
The class below is more complete:
[code:3tc5y7wu]
// Original work from Alex Shaft & Peter Kohler, with mods by Byron Hopp, Rimantas Usevicius
// Modified by Luis Krause May 10, 2003, Optimized and cleaned up code
// Fixed ::Retr() & ::Dir() bugs
// added progress bar capability
// Made socket calls compatible with modified TSocket class (TSmtp, etc.)
// Added a timeout to escape from ::DoWait() to avoid hanging up the system
// Added Proxy support (needs more testing)
// October 14, 2003, Optimized ::Retr() & ::Dir() more - much faster now
// ::oTrnSocket wasn't being properly released. Fixed!
// May 8, 2003 More fixes to ::Retr???() methods
// Fixed ::Stor(), added IVAR nDelay to allow upload to work
// Entries in log file use the following codes:
// "E:" an error occurred; description follows
// "I:" info about the current operation executed
// "S:" data/action sent to the ftp server
// "R:" reply/response returned by ftp server
#include "FiveWin.ch"
#include "Directry.ch"
#ifndef __CLIPPER__
#xtranslate Memory(<n>) => // only needed with Clipper, not Harbour
#endif
#define BLOCK_SIZE 10240
#define ST_CLOSED 0
#define ST_CONNECTING 1
#define ST_CONNECTED 2
#define ST_CONNECTERR 3
#define ST_DOCWD 4
#define ST_DONECWD 5
#define ST_CWDERROR 6
#define ST_DOTYPE 7
#define ST_TYPEOK 8
#define ST_TYPEBAD 9
#define ST_DOPORT 10
#define ST_PORTOK 11
#define ST_PORTBAD 12
#define ST_DOSTOR 13
#define ST_STOROK 14
#define ST_STORBAD 15
#define ST_STORDONE 16
#define ST_DOPASV 17
#define ST_PASVOK 18
#define ST_PASVBAD 19
#define ST_DOQUIT 20
#define ST_QUITOK 21
#define ST_QUITBAD 22
#define ST_DODIR 23
#define ST_DIROK 24
#define ST_DIRBAD 25
#define ST_DIRDONE 26
#define ST_DIRREADY 126
#define ST_DOPWD 27
#define ST_DONEPWD 28
#define ST_PWDERROR 29
#define ST_DORENFROM 30
#define ST_RENFROMOK 31
#define ST_RENFROMBAD 32
#define ST_DORENTO 33
#define ST_RENTOOK 34
#define ST_RENTOBAD 35
#define ST_DODELETE 36
#define ST_DELETEOK 37
#define ST_DELETEBAD 38
#define ST_DOMKDIR 39
#define ST_MKDIROK 40
#define ST_MKDIRBAD 41
#define ST_DORETR 42
#define ST_RETROK 43
#define ST_RETRBAD 44
#define ST_RETRDONE 45
#define ST_DOABOR 46
#define ST_ABOROK 47
#define ST_ABORBAD 48
#define ST_DORMDIR 49
#define ST_RMDIROK 50
#define ST_RMDIRBAD 51
#define NTRIM(n) ( LTrim( Str( n ) ) )
/*
Function Main()
local oWin
DEFINE WINDOW oWin ;
TITLE "FTP Test"
ACTIVATE WINDOW oWin ;
ON INIT FTPTest()
return nil
Static Function FTPTest()
local oFTP
Ferase("logftp.txt")
oFTP := qFTPClient():New("10.1.1.2", 21, {|cMessage| Logfile("logftp.txt", {cMessage})},, ;
"alex", "secret")
// oFTP:bAbort := {|| oApp():oFrmmain:lFormClosed}
oFTP:lPassive := .T.
if oFTP:Connect()
MsgInfo("Connection successful to " + oFTP:cServer + CRLF + oFTP:cServerIP + CRLF + oFTP:oSocket:ClientIP())
if oFTP:Cd("/home/alex")
MSginfo("Successfully changed dir to /pub")
if oFTP:Dir()
Msginfo("Got directory listing")
//Aeval(oFTP:acDir, {| cDir, nCount | Msginfo(Str(nCount) + " " + cDir)})
oFTP:Retr("/etc/hosts", "hosts.txt")
oFTP:Del("hosts.backup")
oFTP:Stor("hosts.txt", "hosts.txt")
oFTP:Rename("hosts.txt", "hosts.backup")
oFTP:Quit()
oFTP:End()
Msginfo("Done")
else
Msginfo("Directory listing failed!")
oFTP:Quit()
oFTP:End()
endif
else
Msginfo("CD to /pub failed!")
oFTP:Quit()
oFTP:End()
endif
else
Msginfo("Connect failed!")
endif
return nil
*/
CLASS qFTPClient
#ifdef __CLIPPER__
DATA oSocket, oTrnSocket, oProxy AS OBJECT, NIL
#else
DATA oSocket, oTrnSocket, oProxy AS OBJECT INIT Nil
#endif
DATA cServer, cServerIP, cUser, cPass, cBuffer, cLastCmd, cReply, cDirBuffer, ;
cDataIP AS String INIT ""
DATA nPort, nDataPort AS NUMERIC INIT 21
DATA nStatus, nRetrHandle AS NUMERIC INIT 0
DATA bResolving, bResolved, bDump, bAbort, bStorProgress ;
AS Codeblock INIT Nil
DATA lResolved, lConnected, lClosed, lSent, lSendFile, lPassive, lSentUser ;
AS Logical Init .F.
DATA acDir, acReply AS Array
DATA nRetrFSize, nRetrBRead AS NUMERIC INIT 0
// allow a small delay when uploading (STOR command) data if there's no way to get an acknowledgment from server
DATA nDelay AS NUMERIC INIT 1
// allow 30 seconds before we bump out of ::DoWait() to avoid hanging up the system
// set to 0 if you're pretty confident this won't happen to you :o)
DATA nTimeOut AS NUMERIC INIT 30
Method New( cServer, nPort, bDump, bAbort, cUser, cPass, cProxyIP, nProxyPort, cProxyLog ) Constructor
Method End()
Method Connect()
Method OnConnect( oSocket, nWSAError )
Method OnRead( oSocket, nWSAError )
Method OnClose( oSocket, nWSAError )
Method Port( oTransSocket )
Method CD( cPath )
Method Pwd()
Method XfrType( cType )
Method Stor( cLocal, cRemote, bStorProgess, oMeter, oText )
Method StorAccept( opSocket, nWSAError, cFile, oMeter, oText ) Hidden
Method StorClose( oSocket, nWSAError, cFile, oMeter, oText ) Hidden
Method Dir( cLoc )
Method DirAccept( opSocket, nWSAError ) Hidden
Method DirRead( oSocket, nWSAError ) Hidden
Method DirClose( oSocket, nWSAError ) Hidden
Method Dump( cMsg )
Method Quit()
Method Bye() Inline ::Quit()
Method DoWait( nState ) Hidden
Method Del( cFile )
Method Rename( cFrom, cTo )
Method MkDir( cDir )
Method RmDir( cDir )
Method Retr( cRemote, cLocal, oMeter, oText )
Method RetrAccept( opSocket, nWSAError, cFile, oMeter, oText ) Hidden
Method RetrRead( oSocket, nWSAError, cFile, oMeter, oText ) Hidden
Method RetrClose( oSocket, nWSAError, cFile, oMeter, oText ) Hidden
Method Abort()
Method Pasv()
EndClass
//---------------------------------------------------------------------------------------------//
/*
Creates FTP Object
Parameters : cServer : Servername e.g. ftp.microsoft.com or 207.46.133.140
nPort : Server FTP Port. Defaults to 21
bDump : Codeblock to send all commands sent, and replies received to. Useful for logging, etc.
bAbort : Codeblock, which if eval's to True, will abort any current waiting process.
cUser : User name to log-in with
cPass : Password to log-in with
cProxyIP : Optional Proxy IP Address
nProxyPort : Optional Proxy Port No.
cProxyLog : Optional Proxy Logfile
*/
Method New( cServer, nPort, bDump, bAbort, cUser, cPass, ;
cProxyIP, nProxyPort, cProxyLog ) Class qFTPClient
Default cServer := "10.1.1.2", ;
nPort := 21, ;
bAbort := {|| .F. }, ;
cUser := "anonymous", ;
cPass := "fwuser@fivetech.com", ;
cProxyIP := "0.0.0.0", ;
nProxyPort := 0
::cServer := cServer
::nPort := nPort
::bAbort := bAbort
::bDump := bDump
::acDir := {}
::acReply := {}
::cUser := cUser
::cPass := cPass
If Val( cProxyIP ) > 0 .and. nProxyPort > 0
::oProxy := TProxy():New( nProxyPort, cProxyIP )
::oProxy:lDebug := bDump # Nil
If cProxyLog # Nil
::oProxy:cLogFile := cProxyLog
Endif
::oProxy:Activate()
Endif
Return Self
//---------------------------------------------------------------------------------------------//
/*
Internal method to give feedback to caller
*/
Method Dump( cMsg ) Class qFTPClient
If ValType( ::bDump ) == "B" .and. ValType( cMsg ) == "C"
Eval( ::bDump, cMsg )
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Logs into the FTP Server, using parameters specified with New Method.
Returns True or False based on connection success
*/
Method Connect() Class qFTPClient
Local nReturn
Local lOK := .F. // was .T. - Thanks to Roberto Chiaiese
::lResolved := .F.
::oSocket := TSocket():New(0)
If ValType( ::bResolving ) == "B"
Eval( ::bResolving, Self )
Endif
If IsAlpha( ::cServer )
::cServerIP := GetHostByName( AllTrim( ::cServer ) ) // PK Note this hogs the pc for up to 35 seconds if it cannot be resolved
Else
::cServerIP := ::cServer
Endif
If ::lResolved := Val( ::cServerIP ) > 0
::oSocket:bConnect := {|o,n| ::OnConnect( o, n ) } // lkm - see adjustment to TSocket class
::oSocket:bRead := {|o,n| ::OnRead( o, n ) }
::oSocket:bClose := {|o,n| ::OnClose( o, n ) }
::nStatus := ST_CONNECTING
Memory(-1) // cleanup memory when connecting frequently
::oSocket:Connect( ::cServerIP, ::nPort )
::DoWait( ST_CONNECTING )
lOK := ::nStatus == ST_CONNECTED
If ValType( ::bResolved ) == "B"
Eval( ::bResolved, Self )
Endif
Endif
Return lOk
//---------------------------------------------------------------------------------------------//
/*
Internal method to handle connection established.
Note it only checks for a bad connection. The rest is done by OnRead
*/
Method OnConnect( oSocket, nWSAError ) Class qFTPClient
If Val( oSocket:ClientIP() ) == 0
::lConnected := .F.
::nStatus := ST_CONNECTERR
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to handle data received by control socket
*/
Method OnRead( oSocket, nWSAError ) Class qFTPClient
Local cData := ""
Local nPos := 0, nPos1, nPos2
Local cCmd := ""
cData := oSocket:GetData()
::cBuffer += cData
Do While ( nPos := At( CRLF, ::cBuffer ) ) > 0 .and. ! Eval( ::bAbort )
AAdd( ::acReply, Left( ::cBuffer, nPos - 1 ) )
::cBuffer := SubStr( ::cBuffer, nPos + 2 )
Enddo
AEval( ::acReply, {|cReply| ::Dump( "R:" + NTRIM( ::nStatus ) + ":" + cReply ) } )
If Len( ::acReply ) > 0 .and. ;
Val( Left( ATail( ::acReply ), 3 ) ) > 0 .and. ; // i.e. skip stuff like:
SubStr( ATail( ::acReply ), 4, 1 ) == " " // "230-" or " ***"
// Full reply received
::cReply := ATail( ::acReply )
cCmd := Left( ::cReply, 3 ) // Left( ::acReply[1], 3 ) <<- caused a ton of problems!
Do Case
Case cCmd == "530" .or. ; // Login incorrect. [or other error]
::nStatus == ST_CLOSED .or. ::nStatus == ST_CONNECTERR
::nStatus := ST_DOQUIT
::lConnected := .F.
Case ::nStatus == ST_CONNECTING
Do Case
Case cCmd == "220" // Ready for user| ProFTPD 1.2.2rc1 Server (ProFTPD) [n.n.n.n]
::Dump( "S:" + NTRIM( ::nStatus ) + ":USER *************" ) // + AllTrim( ::cUser )
oSocket:SendData( "USER " + AllTrim( ::cUser ) + CRLF )
::lSentUser := .T.
Case cCmd == "331" // Password required for ::cUser.
::Dump( "S:" + NTRIM( ::nStatus ) + ":PASS *************" )
oSocket:SendData( "PASS " + AllTrim( ::cPass ) + CRLF )
Case cCmd == "230" // User ::cUser logged in.
::nStatus := ST_CONNECTED
::lConnected := .T.
Otherwise
::nStatus := ST_CONNECTERR
EndCase
Case ::nStatus == ST_DOCWD
Do Case
Case cCmd == "250" // CWD command successful.
::nStatus := ST_DONECWD
Otherwise
::nStatus := ST_CWDERROR
EndCase
Case ::nStatus == ST_DOQUIT
::lConnected := .F.
Do Case
Case cCmd == "221" .or. cCmd == "530" // Goodbye.
::nStatus := ST_QUITOK
Otherwise
::nStatus := ST_QUITBAD
EndCase
Case ::nStatus == ST_DODELETE
Do Case
Case cCmd == "250" // DEL command successful.
::nStatus := ST_DELETEOK
Otherwise
::nStatus := ST_DELETEBAD
EndCase
Case ::nStatus == ST_DOPWD
Do Case
Case cCmd == "257" // PWD command successful.
::nStatus := ST_DONEPWD
Otherwise
::nStatus := ST_PWDERROR
EndCase
Case ::nStatus == ST_DOPORT
Do Case
Case cCmd == "200" // OK
::nStatus := ST_PORTOK
Otherwise
::nStatus := ST_PORTBAD
EndCase
Case ::nStatus == ST_DOTYPE
Do Case
Case cCmd == "200" // Type set to x.
::nStatus := ST_TYPEOK
Otherwise
::nStatus := ST_TYPEBAD
EndCase
Case ::nStatus == ST_DOSTOR
Do Case
Case cCmd == "150"
::nStatus := ST_STOROK
::lSendFile := .T.
Otherwise
::nStatus := ST_STORBAD
EndCase
Case ::nStatus == ST_STOROK
Do Case
Case cCmd == "226" // OK
::nStatus := ST_STORDONE
Otherwise
::nStatus := ST_STORBAD
EndCase
Case ::nStatus == ST_DOPASV
Do Case
Case cCmd == "227" // Entering Passive Mode (n,n,n,n,m,m).
::nStatus := ST_PASVOK
Otherwise
::nStatus := ST_PASVBAD
EndCase
Case ::nStatus == ST_DODIR
Do Case
Case cCmd == "150" // Opening ASCII mode data connection for [file list]
::nStatus := ST_DIROK
Case cCmd == "125" // Data connection already open; Transfer starting.
::nStatus := ST_DIROK // some ftp servers return 125 instead of 150
Otherwise
::nStatus := ST_DIRBAD
EndCase
Case ::nStatus == ST_DIROK .or. ::nStatus == ST_DIRREADY
Do Case
Case cCmd == "226" // Transfer complete.
::nStatus := ST_DIRDONE
Otherwise
::nStatus := ST_DIRBAD
EndCase
Case ::nStatus == ST_DORETR
Do Case
Case cCmd == "150" // Opening BINARY mode data connection for cFile (nnnnn bytes).
If ::nRetrBRead == 0 // in case it jumped the gun (with small files sometimes ST_RETRDONE jumps the gun and file has already arrived!)
nPos1 := At( "(", ::cReply )
nPos2 := At( " bytes)", ::cReply )
::nRetrFSize := Val( SubStr( ::cReply, nPos1 + 1, nPos2 - nPos1 - 1 ) )
Endif
::nStatus := ST_RETROK
Case cCmd == "125" // command 150 never received, therefore we don't know the size of the file being retrieved
If ::nRetrFSize == 0 // horrible hack, but it's the only
::nRetrFSize := 1 // way around this (for the time being)
Endif
::nStatus := ST_RETROK
Otherwise // a 550 means No such file or directory
::nStatus := ST_RETRBAD
EndCase
Case ::nStatus == ST_RETROK .or. ::nStatus == ST_RETRDONE
Do Case
Case cCmd == "226" // Transfer complete.
::nStatus := ST_RETRDONE
Otherwise
::nStatus := ST_RETRBAD
EndCase
Case ::nStatus == ST_DORENFROM
Do Case
Case cCmd == "350"
::nStatus := ST_RENFROMOK
Otherwise
::nStatus := ST_RENFROMBAD
EndCase
Case ::nStatus == ST_DORENTO
Do Case
Case cCmd == "250"
::nStatus := ST_RENTOOK
Otherwise
::nStatus := ST_RENTOBAD
EndCase
Case ::nStatus == ST_DOMKDIR
Do Case
Case cCmd == "257" // OK
::nStatus := ST_MKDIROK
Otherwise
::nStatus := ST_MKDIRBAD
EndCase
Case ::nStatus == ST_DOABOR
Do Case
Case cCmd == "426" // Data connection closed, file transfer cFile aborted.
::nStatus := ST_DOABOR // stay put for successful reply from server
Case cCmd == "225" .or. cCmd == "226" // ABOR command successful.
::nStatus := ST_ABOROK
Otherwise
::nStatus := ST_ABORBAD
EndCase
Case ::nStatus == ST_DORMDIR
Do Case
Case cCmd == "250" // OK
::nStatus := ST_RMDIROK
Otherwise
::nStatus := ST_RMDIRBAD
EndCase
Otherwise
::Dump( "E:" + NTRIM( ::nStatus ) + ":Unknown exception on cmd " + ::cReply )
EndCase
Endif
::acReply := {}
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Used to get directory listing.
cLoc Parameter gives dir spec.
Returns true or false based on success
When True. Data var acDir will hold dir listing as returned by server.
*/
Method Dir( cLoc ) CLASS qFTPClient
Local lOK := .T.
Local cPort := ""
Local nPos := 0
Local cLine := ""
Local cSepChar := ""
Default cLoc := ""
::acDir := {}
::cDirBuffer := ""
::oTrnSocket := TSocket():New(0)
If ! ::lPassive
cPort := ::Port( ::oTrnSocket )
::oTrnSocket:bAccept := {|o,n| ::DirAccept( o, n ) }
::oTrnSocket:Listen()
::Dump( "I:" + NTRIM( ::nStatus ) + ":Listening on port " + NTRIM( ::oTrnSocket:nPort ) )
::nStatus := ST_DOPORT
::Dump( "S:" + NTRIM( ::nStatus ) + ":" + cPort )
::oSocket:SendData( cPort + CRLF )
::DoWait( ST_DOPORT )
lOK := ::nStatus == ST_PORTOK
Else
If ::Pasv()
If lOK := ::nDataPort > 0
::oTrnSocket:bConnect := {|o,n| ::DirAccept( o, n ) }
::oTrnSocket:bRead := {|o,n| ::DirRead( o, n ) }
::oTrnSocket:bClose := {|o,n| ::DirClose( o, n ) }
::Dump( "I:" + NTRIM( ::nStatus ) + ":Connecting on IP:port " + ::cDataIP + ":" + NTRIM( ::nDataPort ) )
Memory(-1) // cleanup memory when connecting frequently
::oTrnSocket:Connect( ::cDataIP, ::nDataPort )
Endif
Endif
Endif
If lOK
::nStatus := ST_DODIR
::Dump( "S:" + NTRIM( ::nStatus ) + ":LIST " + AllTrim( cLoc ) )
::oSocket:SendData( "LIST " + AllTrim( cLoc ) + CRLF )
::DoWait( ST_DODIR )
::DoWait( ST_DIROK )
If lOK := ::nStatus == ST_DIRDONE
::Dump( "I:" + NTRIM( ::nStatus ) + ":Interpreting dir listing" )
cSepChar := CRLF
nPos := At( cSepChar, ::cDirBuffer )
If nPos == 0
If ! Empty( ::cDirBuffer ) // single line, just one file, THEREFORE there won't be any CRLF's!
::cDirBuffer += CRLF
Else
cSepChar := Chr(10)
Endif
nPos := At( cSepChar, ::cDirBuffer )
Endif
::acDir := {}
Do While nPos > 0 .and. ! Eval( ::bAbort )
cLine := AllTrim( Left( ::cDirBuffer, nPos - 1 ) )
::cDirBuffer := SubStr( ::cDirBuffer, nPos + Len( cSepChar ) )
cLine := AllTrim( StrTran( cLine, Chr(0), "" ) )
If( ! Empty( cLine ), AAdd( ::acDir, cLine ), Nil )
nPos := At( cSepChar, ::cDirBuffer )
SysRefresh()
Enddo
lOk := ! Empty( ::acDir )
::nStatus := ST_DIRREADY
SysWait( ::nDelay ) // allow time for server to respond
Else
::Abort()
Endif
Endif
If ::oTrnSocket # Nil
::oTrnSocket:End()
::oTrnSocket := Nil
Endif
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage directory socket
*/
Method DirAccept( opSocket, nWSAError ) Class qFTPClient
Local oSocket
If ! ::lPassive
oSocket := TSocket():Accept( opSocket:nSocket )
oSocket:bRead := {|o,n| ::DirRead( o, n ) }
oSocket:bClose := {|o,n| ::DirClose( o, n ) }
Endif
::Dump( "I:" + NTRIM( ::nStatus ) + ":LIST data connection established" )
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage directory socket
*/
Method DirRead( oSocket, nWSAError ) Class qFTPClient
Local cData := oSocket:GetData()
::cDirBuffer += cData
::Dump( "I:" + NTRIM( ::nStatus ) + ":LIST data received" )
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage directory socket
*/
Method DirClose( oSocket, nWSAError ) Class qFTPClient
::Dump( "I:" + NTRIM( ::nStatus ) + ":LIST data socket closed:" + CRLF + ::cDirBuffer )
oSocket:Close()
::nStatus := ST_DIRDONE
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to handle socket closed by server
*/
Method OnClose( oSocket, nWSAError ) Class qFTPClient
::Dump( "I:" + NTRIM( ::nStatus ) + ":Server closed down" )
::lClosed := .T.
::nStatus := ST_CLOSED
If ValType( ::oSocket ) == "O"
::oSocket:Close()
::oSocket := Nil
Endif
If ValType( ::oTrnSocket ) == "O"
::oTrnSocket:Close()
::oTrnSocket := Nil
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Kills connections
*/
Method End() Class qFTPClient
If ValType( ::oSocket ) == "O"
::oSocket:End()
::oSocket := Nil
Endif
If ValType( ::oTrnSocket ) == "O"
::oTrnSocket:End()
::oTrnSocket := Nil
Endif
If ValType( ::oProxy ) == "O"
::oProxy:End()
::oProxy := Nil
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to obtain unused port no. for data connections.
*/
METHOD Port( oTransSocket ) Class qFTPClient
Local cIP := GetIP( ::oSocket:nSocket )
Local nPort
Local cPort
Local cComplement
BindToPort( oTransSocket:nSocket, 0 ) // Get a free port from 1024 - 5000
nPort := GetPort( oTransSocket:nSocket )
cPort := AllTrim( Str( Int( nPort / 256 ), 3 ) )
cComplement := AllTrim( Str( Int( nPort % 256 ), 3 ) )
oTransSocket:nPort := nPort
Return "PORT " + StrTran( AllTrim( StrTran( cIP, ".", "," ) ) + ;
"," + cPort + "," + cComplement, " ", "" )
//---------------------------------------------------------------------------------------------//
/*
Change directory on FTP Server.
Returns True or False based on success
*/
Method CD( cPath ) Class qFTPClient
Local lOK := .T.
::nStatus := ST_DOCWD
::Dump( "S:" + NTRIM( ::nStatus ) + ":CWD " + cPath )
::oSocket:SendData( "CWD " + cPath + CRLF )
::DoWait( ST_DOCWD )
lOK := ::nStatus == ST_DONECWD
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Used internally to set Binary transfer mode for transfers
*/
Method XfrType( cType ) Class qFTPClient
Local lOK := .T.
Default cType := "I"
::nStatus := ST_DOTYPE
::Dump( "S:" + NTRIM( ::nStatus ) + ":TYPE " + cType )
::oSocket:SendData( "TYPE " + cType + CRLF )
::DoWait( ST_DOTYPE )
lOK := ::nStatus == ST_TYPEOK
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Used to store files on server.
Parameters : cLocal : Local File to send
cRemote : Location to store file remotely
bStorProgess : Codeblock to get percent complete
oMeter : Meter object progress bar [optional]
oText : Say object used with meter object to display bytes processed [optional]
Returns True or False based on success
*/
Method Stor( cLocal, cRemote, bStorProgress, oMeter, oText ) Class qFTPClient
Local cRemFile := ""
Local nPos := 0
Local cPort := ""
Local lOK := .T.
Default cRemote := "", ;
bStorProgress := {|| Nil }
::bStorProgress := bStorProgress
::lSendFile := .F.
If Empty( cRemote )
If ( nPos := RAt( "\", cLocal ) ) > 0
cRemFile := SubStr( cLocal, nPos + 1 )
Else
cRemFile := cLocal
Endif
Else
cRemFile := cRemote
Endif
If oMeter # Nil
oMeter:cargo := .T. // cancel button available while download in progress
oMeter:oWnd:AEvalWhen()
Endif
::XfrType( "I" )
::DoWait( ST_DOTYPE )
::oTrnSocket := TSocket():New(0)
If lOK := ::nStatus == ST_TYPEOK
If ! ::lPassive
cPort := ::Port( ::oTrnSocket )
::oTrnSocket:bAccept := {|o,n| ::StorAccept( o, n, cLocal, oMeter, oText ) }
::oTrnSocket:Listen()
::Dump( "I:" + NTRIM( ::nStatus ) + ":Listening on port " + NTRIM( ::oTrnSocket:nPort ) )
::nStatus := ST_DOPORT
::Dump( "S:" + NTRIM( ::nStatus ) + ":" + cPort )
::oSocket:SendData( cPort + CRLF )
::DoWait( ST_DOPORT )
lOK := ::nStatus == ST_PORTOK
Else
If ::Pasv()
If lOK := ::nDataPort > 0
::oTrnSocket:bConnect := {|o,n| ::StorAccept( o, n, cLocal, oMeter, oText ) }
::oTrnSocket:bClose := {|o,n| ::StorClose( o, n, cLocal, oMeter, oText ) }
::Dump( "I:" + NTRIM( ::nStatus ) + ":Connecting on IP:port " + ::cDataIP + ":" + NTRIM( ::nDataPort ) )
Memory(-1) // cleanup memory when connecting frequently
::oTrnSocket:Connect( ::cDataIP, ::nDataPort )
Endif
Endif
Endif
Endif
If lOk
::nStatus := ST_DOSTOR
::Dump( "S:" + NTRIM( ::nStatus ) + ":STOR " + cRemFile )
::oSocket:SendData( "STOR " + cRemFile + CRLF )
::DoWait( ST_DOSTOR )
::DoWait( ST_STOROK )
lOK := ::nStatus == ST_STORDONE
Endif
If ::oTrnSocket # Nil
::oTrnSocket:End()
::oTrnSocket := Nil
Endif
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage file store socket
*/
Method StorAccept( opSocket, nWSAError, cFile, oMeter, oText ) Class qFTPClient
Local oSocket
Local hFile := 0
Local cBuffer := ""
Local nSent := 0
Local nTotal := 0
Local lClosed := .F.
Local nNow := 0
Local nSize
If ! ::lPassive
oSocket := TSocket():Accept( opSocket:nSocket )
oSocket:bClose := {|o,n| ::StorClose( o, n, cFile, oMeter, oText ), lClosed := .T. }
Else
oSocket := opSocket
Endif
Do While ! ::lSendFile .and. ! ::lClosed .and. ! Eval( ::bAbort )
SysRefresh()
Enddo
If ::lSendFile
::Dump( "I:" + NTRIM( ::nStatus ) + ":STOR data connection established" )
nNow := Seconds()
If ( hFile := FOpen( cFile ) ) > 0
nSize := Directory( cFile )[1,F_SIZE]
::Dump( "I:" + NTRIM( ::nStatus ) + ":Uploading " + cFile + ", " + NTRIM( nSize ) + " bytes in size" )
If oMeter # Nil
oMeter:Set(0) // reset
oMeter:SetTotal( nSize ) // set bar length
Endif
cBuffer := Space( BLOCK_SIZE )
Do While .T.
nSent := FRead( hFile, @cBuffer, BLOCK_SIZE )
oSocket:SendData( Left( cBuffer, nSent ) )
nTotal += nSent
If ::nDelay > 0
SysWait( ::nDelay ) // this is trial and error... I'm using 0.5 to 1.5; default is 1.0
Endif
Eval( ::bStorProgress, Round( nTotal / nSize * 100, 2 ) ) // left for compatibility with original class
If( oMeter # Nil, oMeter:Set( nTotal ), Nil )
If( oText # Nil, oText:SetText( cFile + ": " + NTRIM( nTotal ) + " bytes uploaded..." ), Nil )
If nSent < BLOCK_SIZE .or. lClosed .or. ::nStatus == ST_STORBAD .or. Eval( ::bAbort )
Exit
Endif
If ::nDelay == 0
SysRefresh()
Endif
Enddo
FClose( hFile )
::Dump( "I:" + NTRIM( ::nStatus ) + ":" + NTRIM( nTotal ) + " bytes of file sent in " + LTrim( Str( Seconds() - nNow, 16, 2 ) ) + " seconds" )
::Dump( "I:" + NTRIM( ::nStatus ) + ":Waiting for acknowledgement" )
oSocket:Close()
Else
oSocket:Close()
oSocket:End()
::Dump( "E:" + NTRIM( ::nStatus ) + ":FOpen() failed with file " + cFile + " DOS Error #" + NTRIM( FError() ) )
Endif
SysRefresh()
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage file store socket
*/
Method StorClose( oSocket, nWSAError, cFile, oMeter, oText ) Class qFTPClient
If oMeter # Nil
oMeter:cargo := .F. // cancel button not available anymore
oMeter:oWnd:AEvalWhen()
Endif
::lSendFile := .F.
oSocket:Close()
If ::nStatus == ST_DOABOR .or. ::nStatus == ST_ABOROK .or. ;
::nStatus == ST_ABORBAD .or. ::nStatus == ST_STORBAD
::Dump( "I:" + NTRIM( ::nStatus ) + ":STOR data aborted" )
Else
::Dump( "I:" + NTRIM( ::nStatus ) + ":STOR data completed :-)" )
::nStatus := ST_STORDONE
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Close FTP Connection
*/
Method Quit() Class qFTPClient
::nStatus := ST_DOQUIT
::Dump( "S:" + NTRIM( ::nStatus ) + ":QUIT" )
::oSocket:SendData( "QUIT" + CRLF )
::DoWait( ST_DOQUIT )
Return .T.
//---------------------------------------------------------------------------------------------//
/*
Get current directory on FTP Server
Returns True or False based on success
*/
Method Pwd() Class qFTPClient
Local cRetVal := ""
Local nPos := ""
Local cReply
::nStatus := ST_DOPWD
::Dump( "S:" + NTRIM( ::nStatus ) + ":PWD" )
::oSocket:SendData( "PWD" + CRLF )
::DoWait( ST_DOPWD )
cReply := ::cReply
nPos := At( '"', cReply )
cReply := SubStr( cReply, nPos + 1 )
nPos := At( '"', cReply )
cReply := SubStr( cReply, 1, nPos - 1 )
cRetVal := cReply
Return cRetVal
//---------------------------------------------------------------------------------------------//
/*
Delete file (cFile of server)
Will return Success True or False
*/
Method Del( cFile ) Class qFTPClient
Local lOK := .T.
Default cFile := ""
::nStatus := ST_DODELETE
If lOK := ! Empty( cFile )
::Dump( "S:" + NTRIM( ::nStatus ) + ":DELE " + cFile )
::oSocket:SendData( "DELE " + cFile + CRLF )
::DoWait( ST_DODELETE )
lOK := ::nStatus == ST_DELETEOK
Endif
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Rename file on server
Parameters : cFrom : Source file
cTo : Target file
Will return Success True or False
*/
Method Rename( cFrom, cTo ) Class qFTPClient
Local lOK := .F.
Default cFrom := "", ;
cTo := ""
If lOK := ! Empty( cFrom ) .and. ! Empty( cTo )
::nStatus := ST_DORENFROM
::Dump( "S:" + NTRIM( ::nStatus ) + ":RNFR " + cFrom )
::oSocket:SendData( "RNFR " + cFrom + CRLF )
::DoWait( ST_DORENFROM )
If lOK := ::nStatus == ST_RENFROMOK
::nStatus := ST_DORENTO
::Dump( "S:" + NTRIM( ::nStatus ) + ":RNTO " + cTo )
::oSocket:SendData( "RNTO " + cTo + CRLF )
::DoWait( ST_DORENTO )
lOK := ::nStatus == ST_RENTOOK
Endif
Endif
Return lOk
//---------------------------------------------------------------------------------------------//
/*
Create a directory
*/
Method MkDir( cDir ) Class qFTPClient
Local lOK := .T.
::nStatus := ST_DOMKDIR
::Dump( "S:" + NTRIM( ::nStatus ) + ":MKD " + cDir )
::oSocket:SendData( "MKD " + cDir + CRLF )
::DoWait( ST_DOMKDIR )
lOK := ::nStatus == ST_MKDIROK
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Remove a directory
*/
Method RmDir( cDir ) Class qFTPClient
Local lOK := .T.
::nStatus := ST_DORMDIR
::Dump( "S:" + NTRIM( ::nStatus ) + ":RMD " + cDir )
::oSocket:SendData( "RMD " + cDir + CRLF )
::DoWait( ST_DORMDIR )
lOK := ::nStatus == ST_RMDIROK
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Retrieve file from server.
Parameters : cRemote : Remote file name
cLocal : Local file name
oMeter : Meter object progress bar [optional]
oText : Say object used with meter object to display bytes processed [optional]
*/
Method Retr( cRemote, cLocal, oMeter, oText ) Class qFTPClient
Local lOK := .T.
Local cPort := ""
Local nPos := 0
Local cLine := ""
Local nNow := 0
nPos := RAt( "/", cRemote )
If nPos == 0
Default cLocal := cRemote
Else
Default cLocal := SubStr( cRemote, nPos + 1 )
Endif
If oMeter # Nil
oMeter:cargo := .T. // cancel button available while download in progress
oMeter:oWnd:AEvalWhen()
Endif
::nRetrHandle := FCreate( cLocal )
If lOK := ( ::nRetrHandle > 0 )
::XfrType( "I" )
::DoWait( ST_DOTYPE )
If lOK := ::nStatus == ST_TYPEOK
::oTrnSocket := TSocket():New(0)
If ! ::lPassive
cPort := ::Port( ::oTrnSocket )
::oTrnSocket:bAccept := {|o,n| ::RetrAccept( o, n, cRemote, oMeter, oText ) }
::oTrnSocket:Listen()
::Dump( "I:" + NTRIM( ::nStatus ) + ":Listening on port " + NTRIM( ::oTrnSocket:nPort ) )
::nStatus := ST_DOPORT
::Dump( "S:" + NTRIM( ::nStatus ) + ":" + cPort )
::oSocket:SendData( cPort + CRLF )
::DoWait( ST_DOPORT )
lOK := ::nStatus == ST_PORTOK
Else
If ::Pasv()
If lOK := ::nDataPort > 0
::oTrnSocket:bConnect := {|o,n| ::RetrAccept( o, n, cRemote, oMeter, oText ) }
::oTrnSocket:bRead := {|o,n| ::RetrRead( o, n, cRemote, oMeter, oText ) }
::oTrnSocket:bClose := {|o,n| ::RetrClose( o, n, cRemote, oMeter, oText ) }
::Dump( "I:" + NTRIM( ::nStatus ) + ":Connecting on IP:port " + ::cDataIP + ":" + NTRIM( ::nDataPort ) )
Memory(-1) // cleanup memory when connecting frequently
::oTrnSocket:Connect( ::cDataIP, ::nDataPort )
Endif
Endif
Endif
Endif
Else
::Dump( "E:" + NTRIM( ::nStatus ) + ":FCreate() failed with file " + cLocal + " DOS Error #" + NTRIM( FError() ) )
Endif
If lOK
::nRetrBRead := 0 // initialize here, not in ::OnRead()
::nStatus := ST_DORETR
::Dump( "S:" + NTRIM( ::nStatus ) + ":RETR " + cRemote )
::oSocket:SendData( "RETR " + cRemote + CRLF )
::DoWait( ST_DORETR )
Do While ::nRetrBRead < ::nRetrFSize .and. ; // stay put until file fully downloaded so it won't be truncated
! ::nRetrHandle == 0 .and. ! ::lClosed .and. ! Eval( ::bAbort ) .and. ;
! ::nStatus == ST_RETRBAD // this is case the file was not found: 550 ?????.???: No such file or directory
SysRefresh()
Enddo
::DoWait( ST_RETROK )
lOK := ::nStatus == ST_RETRDONE
SysWait( ::nDelay ) // allow time for server to respond
Endif
If ::oTrnSocket # Nil
::oTrnSocket:End()
::oTrnSocket := Nil
Endif
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage file retrieval socket
*/
Method RetrAccept( opSocket, nWSAError, cFile, oMeter, oText ) Class qFTPClient
Local oSocket
If ! ::lPassive
oSocket := TSocket():Accept( opSocket:nSocket )
oSocket:bRead := {|o,n| ::RetrRead( o, n, cFile, oMeter, oText ) }
oSocket:bClose := {|o,n| ::RetrClose( o, n, cFile, oMeter, oText ) }
Endif
::Dump( "I:" + NTRIM( ::nStatus ) + ":RETR data connection established" )
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage file retrieval socket
*/
Method RetrRead( oSocket, nWSAError, cFile, oMeter, oText ) Class qFTPClient
Local cData := oSocket:GetData()
If ::nRetrHandle > 0
If ::nRetrBRead == 0 .and. oMeter # Nil
oMeter:Set(0) // reset
oMeter:SetTotal( ::nRetrFSize ) // set bar length
Endif
FWrite( ::nRetrHandle, cData )
::nRetrBRead += Len( cData )
If( oMeter # Nil, oMeter:Set( ::nRetrBRead ), Nil )
If( oText # Nil, oText:SetText( cFile + ": " + NTRIM( ::nRetrBRead ) + " bytes downloaded..." ), Nil )
//::Dump( "I:" + NTRIM( ::nStatus ) + ":Bytes retrieved " + NTRIM( ::nRetrBRead ) + " out of " + NTRIM( ::nRetrFSize ) )
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Internal method to manage file retrieval socket
Note: When retrieving very small files, the file might already be downloaded
before ::nRetrFSize can even be initialized (cmd 150). So it's OK if it's ZERO
*/
Method RetrClose( oSocket, nWSAError, cFile, oMeter, oText ) Class qFTPClient
If oMeter # Nil
oMeter:cargo := .F. // cancel button not available anymore
oMeter:oWnd:AEvalWhen()
Endif
FClose( ::nRetrHandle )
::nRetrHandle := 0
oSocket:Close()
If ::nStatus == ST_DOABOR .or. ::nStatus == ST_ABOROK .or. ;
::nStatus == ST_ABORBAD .or. ::nStatus == ST_RETRBAD
::Dump( "I:" + NTRIM( ::nStatus ) + ":RETR data aborted" )
Else
::Dump( "I:" + NTRIM( ::nStatus ) + ":RETR data completed" + If( ::nRetrBRead < ::nRetrFSize, ;
", but file truncated by " + NTRIM( ::nRetrFSize - ::nRetrBRead ) + " bytes :-(", " :-)" ) )
// this should avoid the occasional hanging in ::DoWait()
::nStatus := If( ::nRetrFSize == 0 .or. ::nRetrBRead >= ::nRetrFSize, ST_RETRDONE, ST_RETRBAD )
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
/*
Cancel any transfer/command in progress.
Called by class if bAbort block evals to true in wait state.
*/
Method Abort() Class qFTPClient
Local lOK := .T., nStatus := ::nStatus, bAbort := ::bAbort
::bAbort := {|| .F. } // avoid nested calls to ::Abort()
::nStatus := ST_DOABOR
::Dump( "S:" + NTRIM( ::nStatus ) + ":ABOR while on " + NTRIM( nStatus ) )
::oSocket:SendData( "ABOR" + CRLF )
::DoWait( ST_DOABOR )
lOK := ::nStatus == ST_ABOROK
::bAbort := bAbort // restore abort codeblock
Return lOK
//---------------------------------------------------------------------------------------------//
/*
Switch next transfer to passive mode
*/
Method Pasv() Class qFTPClient
Local cReply := ""
Local nPos := 0
::nStatus := ST_DOPASV
::Dump( "S:" + NTRIM( ::nStatus ) + ":PASV" )
::oSocket:SendData( "PASV" + CRLF )
::DoWait( ST_DOPASV )
If ::lPassive := ::nStatus == ST_PASVOK
cReply := ::cReply
nPos := At( "(", cReply )
cReply := SubStr( cReply, nPos + 1 )
nPos := At( ")", cReply )
cReply := Left( cReply, nPos - 1 )
::cDataIP := StrToken( cReply, 1, "," ) + "."
::cDataIP += StrToken( cReply, 2, "," ) + "."
::cDataIP += StrToken( cReply, 3, "," ) + "."
::cDataIP += StrToken( cReply, 4, "," )
::nDataPort := 0
::nDataPort += 256 * Val( StrToken( cReply, 5, "," ) )
::nDataPort += Val( StrToken( cReply, 6, "," ) )
::Dump( "I:" + NTRIM( ::nStatus ) + ":Server has opened connection on port " + NTRIM( ::nDataPort ) + " - IP:" + ::cDataIP )
Endif
Return ::lPassive
//---------------------------------------------------------------------------------------------//
/*
Internal method to wait for responses from server.
*/
Method DoWait( nState ) Class qFTPClient
Local nStart := Seconds()
Do While ::nStatus == nState .and. ! ::lClosed .and. ! Eval( ::bAbort )
If ::nTimeOut > 0 .and. Seconds() - nStart > ::nTimeOut
::Dump( "E:" + NTRIM( ::nStatus ) + ":Timed out waiting for state " + NTRIM( nState ) + " to finish" )
Exit
Endif
SysRefresh()
Enddo
If nState # ST_DOABOR .and. Eval( ::bAbort )
::Abort()
Endif
Return Nil
//---------------------------------------------------------------------------------------------//
[/code:3tc5y7wu] |
Cliente Telnet | ¿ Alguna clase TELNET ? |
Cliente Telnet | Hola JM, tengo una implementacion muy basica para Telnet, si no necesitas emulacion de terminal VT100 ,VTxxx puede valerte, sino tendrias que desarrollar el modulo para interpretar las secuencias de escape.
Mandame un privado si te interesa lo que tengo hecho, soy Gabriel de Mallorca.
Un saludo |
Cliente Telnet | [quote="Biel EA6DD":3sh8en08]...tengo una implementacion muy basica para Telnet...[/quote:3sh8en08]
Igual me sirve.
No quiero un cliente telnet a lo bestia sino que me permita utilizar comandos.
Por ejemplo quiero entrar en una maquina Sun con Solaris 8 y pedirle cuales son sus interfaces de red.
Para ello me basta con ejecutar el comando [b:3sh8en08]ifconfig -a > /tmp/Interfaces.txt[/b:3sh8en08]
Posteriormente con FTP me traigo el fichero "/tmp/Interfaces.txt".
Quien dice ese comando pues cualquier comando de Unix-Solaris 8.
Las posibilidades se me antojan infinitas... tirar procesos, arrancar servicios... etc ...
Muchas gracias por tu ofrecimiento. |
Cliente Telnet | [quote="Biel EA6DD":17sa1lza]...si no necesitas emulacion de terminal VT100 ,VTxxx puede valerte...[/quote:17sa1lza]
Pues precisamente necesito VT100.
Por lo que he podido comprobar con un cliente telnet (el de windows) y un sniffer Ethereal y Analyzer que desde que se establece la conexion TCPIP hasta que aparece la peticion de login pues hay como unos 4 o 5 mensajes de intercambio entre el cliente y el servidor con valores no ASCII y que entre ellos he visto la palabra VT100 pero el resto de cosas son indescifrables...
Lo tengo crudo... hare con el FTP lo que pueda y del TELNET pues eso... socooorrrroooooooooo... <!-- s:wink: --><img src="{SMILIES_PATH}/icon_wink.gif" alt=":wink:" title="Wink" /><!-- s:wink: -->
Gracias a todos.
Seguire dando la coña <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
Cliente Telnet | Pues investigando podria salir del apuro con el RemoteShell (rsh.exe)
Puedo poner en un ventana de MS-DOS esto: [b:3dm8jbqt]rsh <host> -l <usuario> ifconfig -a[/b:3dm8jbqt] y me contesta con el resultado del comando.
Pero esto es en una ventana MS-DOS.
No puedo redireccionar (>) ya que eso supondria que es parte del comando unix.
¿ Hay alguna forma de hacerse con el TEXTO que hay en una ventana MS-DOS ?
¿ Tenemos alguna clase RSH (Remote Shell) ?
Gracias. |
Cliente Telnet | Hola,
si lo que deseas es tener simplemente informacion del equipo con UNIX, crea un servidor
con PERL en el unix en un determinado puerto y los dejas como servicio del unix, luego desde tu programa en FW con socket te conectas con el y te pasa la informacion que necesitas.
Claro lo complicado aqui es que tendrias que poner este servicio en cada equipo unix
Solor es una idea
Saludos
Marcelo |
Cliente Telnet | [quote="Marcelo Via Giglio":36l2fi18]...Claro lo complicado aqui es que tendrias que poner este servicio en cada equipo unix...[/quote:36l2fi18]
No solo eso, sino que no soy el "amo" de los equipos y tienen lo que tiene y solo me dan login y pass...
Con "Remote Shell" seria feliz <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: --> (remote shel de FW, jejeje) |
Cliente Telnet | Bueno, pues al final lo he solucionado con el REMOTE SHELL.
Las maquinas Unix a las que "ataco" para pedir datos lo tiene activado.
Entonces con el comando [b:yfxz9e2e]rsh[/b:yfxz9e2e] de windows (el MS-DOS nunca muere) y la consola [b:yfxz9e2e]cmd[/b:yfxz9e2e] hago lo siguiente.
[code:yfxz9e2e]function main()
local oShell:=TOleAuto():New("WScript.Shell")
oShell:Run("cmd /K rsh 99.99.99.99 -l usuario ifconfig -a > tmp.txt & exit",0,.F.)
MagInfo(Memoread("tmp.txt")) // Visualiza las IPs de las tarjetas de red de la maquina Unix
return nil[/code:yfxz9e2e]
Para que la pantalla de MS-DOS no aparezca al metodo :Run se le pasa los parametros "0,.T.". |
Cliente postgresql para mingw | Hola,
¿ Alguien sabe donde se puede descargar o como se puede construir la librería del cliente de postgresql, para mingw?
Mi idea es la pgsql.a pero como librería estática, es decir, no quiere tener una pgsql.dll y una .a para enlazar. Sólo la .a ya compilada con las funciones
dentro, sin depender de una .dll externa.
He buscado en muchos sitios y de verdad no he sido capaz de encontrarlo.
Agradecería mucho vuestra ayuda. |
Clipboard TEXT | hi,
i copy Filename from App to Clipboard
later i paste from Cliboard back to App and want "goto" File
but it does not work <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
paste Filename into Notepad
mark Filename "in" Notepad and copy back to Clipboard
now it work <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
---
than i had a look into Logfile and found
[quote:1m6uuo7f]28.02.2023 07:46:42: COPYTOCLIPBOARD( 3386 ) cText = E"C:\fwh\0\LISTVIEW\TGRID.BAK\r\n "
28.02.2023 07:47:08: TEXTFROMCLIPBOARD( 3400 ) cText = E"C:\fwh\0\LISTVIEW\TGRID.BAK\r\n"
28.02.2023 07:47:25: TEXTFROMCLIPBOARD( 3400 ) cText = "C:\fwh\0\LISTVIEW\TGRID.BAK"[/quote:1m6uuo7f]
where are E and \r\n come from <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
how can i get rid of it <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
---
[code=fw:1m6uuo7f]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> CopyToClipboard<span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oClip := TClipBoard<span style="color: #000000;">(</span><span style="color: #000000;">)</span> :<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oClip:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oClip:<span style="color: #000000;">SetText</span><span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br />* oClip:<span style="color: #000000;">SetWideText</span><span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br /> oClip:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oClip:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span></div>[/code:1m6uuo7f]
[code=fw:1m6uuo7f]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> TextFromClipboard<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> cText := <span style="color: #ff0000;">""</span><br /><span style="color: #00C800;">LOCAL</span> oClip := TClipBoard<span style="color: #000000;">(</span><span style="color: #000000;">)</span> :<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oClip:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> cText := oClip:<span style="color: #000000;">GetText</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />* cText := oClip:<span style="color: #000000;">GetUnicodeText</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oClip:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oClip:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> cText<br /> </div>[/code:1m6uuo7f] |
Clipboard question | A couple months ago I incorporated a change from this forum, basic code below, to be able to fetch the clipboard contents, edit it, then put the edited version into the get . This stopped working with the last update, in the following code it crashes on the oClp:Open() line, giving me a TGet():MsgNotFound(0) error. What might have changed in fivewin to cause this to start happening, and what is the solution?
[code=fw:3vtfaw76]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #B900B9;">// oSegment is a get</span><br />oSegment:<span style="color: #000000;">bGotFocus</span> := <span style="color: #000000;">{</span> |oClp| ColToString<span style="color: #000000;">(</span> oClp <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /><span style="color: #00C800;">STATIC</span> PROCEDURE ColToString<span style="color: #000000;">(</span> oClp <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cText<br /><br /> <span style="color: #00C800;">IF</span> oClp:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <<== Crashes with TGet<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">MsgNotFound</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span> here<br /> cText := AllTrim<span style="color: #000000;">(</span> oClp:<span style="color: #000000;">GetText</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> cText != <span style="color: #00C800;">NIL</span><br /> <span style="color: #00C800;">IF</span> _LF $ cText<br /> cText := StrTran<span style="color: #000000;">(</span> cText, _CRLF, _LF <span style="color: #000000;">)</span><br /> cText := StrTran<span style="color: #000000;">(</span> cText, _LF, <span style="color: #ff0000;">","</span> <span style="color: #000000;">)</span><br /> cText := StrTran<span style="color: #000000;">(</span> cText, <span style="color: #ff0000;">" "</span>, <span style="color: #ff0000;">","</span> <span style="color: #000000;">)</span><br /> cText := AllTrim<span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> <span style="color: #0000ff;">Right</span><span style="color: #000000;">(</span> cText, <span style="color: #000000;">01</span> <span style="color: #000000;">)</span> == <span style="color: #ff0000;">","</span><br /> cText := RTrim<span style="color: #000000;">(</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">(</span> cText, Len<span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> oClp:<span style="color: #000000;">Clear</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oClp:<span style="color: #000000;">SetText</span><span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oClp:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span><br /><br /> </div>[/code:3vtfaw76] |
Clipboard question | Robert,
Please modify this line this way:
oSegment:bGotFocus := { |oClp| ColToString() } // We don't provide oClp as a param, which it is a TGet object to function ColToString()
that way, oClp will arrive as a nil to function ColToString() and there should be no error TGet():MsgNotFound(0)
also you need to define a local oClp := TClipboard():New() inside function ColToString() |
Clipboard size | We have a problem when very long text (> 100.000 characters) is copied to the clipboard - only part of it can be pasted.What can be done?Is there a limit of the clipboard?Thanks for help,Dietmar |
Clipboard size | Dietmar,The clipboard should be able to support up to 2GB strings or more (limited by max available memory).Are you copying from a richedit control ? |
Clipboard size | no I'm using FGet (with many modifications for our use)with oClp:SetText( cText ) oClp:GetText( )I can see that only part of very long texts are copied.I there a limit by Windows? (same results with xP and vista)Thanks,Dietmar |
Clipboard size | If you Google "clipboard maximum size" you will get a lot of different opinions on this. It seems most people say that the limit was 32K in 16bit but in 32bit the maximum is limited to available memory which can, of course, vary from time to time even on the same computer. So, I think you are always going to have some problems with copying large amounts of text.James |
Clipboard size | Dietmar,just an idea and not tested.Test your text string for binary zeroes.Clipper and xHarbour can handle these characters in a string.But in c language a '\0', which is chr( 0 ) terminates a string.May be that this causes your problem ?Regards,Detlef |
Clipboard size | Hello Dietmar,Did you ever get this issue resolved? I'm having a problem with the Windows Clipboard only accepting about 20k of text. I'm using FWH 8.10 and Windows XP. As a test I modified the PlaceSomeText() function of the TestClip.prg sample as follows:[code:pc3xym7e]
function PlaceSomeText()
local cText := Space( 30 )
//if MsgGet( "Ok...", "Write something!", @cText )
// oClp:SetText( cText )
//endif
oClp:SetText( Replicate( "ABCDEFGHIJ" + Chr( 13 ) + Chr( 10 ), 100000 ) )
nMsgBox( "Number of bytes in clipboard: " + Str( Len( oClp:GetText() ) ) )
return nil
[/code:pc3xym7e]When I run it and select Use The Clipboard, Place Some Text, I get 20,352 in the result:[img]<!-- m --><a class="postlink" href="http://www.donorquest.com/images/TestClp.jpg">http://www.donorquest.com/images/TestClp.jpg</a><!-- m -->[/img]It should be 1,200,000 bytes based on replicating the string "ABCDEFGHIJ" (plus CR-LF) 100,000 times.I have tried it on two different XP machines and still get the same result.Thanks,-Patrick |
Clipboard size | Patrick,We are going to test it in a few minutes... <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Clipboard size | Patrick,You are right, it seems as its size is limited (around 32 Ks).The text that you want to copy, where will it be used from ? I mean, will it be used from the same application, or from another application ? |
Clipboard size | Antonio,The text will be used in another application. The particular feature I am implementing copies delimited email addresses to the Clipboard so that they may be pasted in the TO: or BCC: block of an email message using whatever email software our customer prefers to use. There may be a better way of allowing our customers to do a mass email to a select group of their constituents, so I'm open to suggestions. However, having full access to the Windows Clipboard is very important and not something I would want to worry about having a limit on. I'm able to copy and paste many megabytes worth of text from my editor to a FWH memo field, and from a memo field back to the Clipboard and my editor, so I don't think it's a Windows limitation. My feeling is that it must be something with Harbour or FiveWin. It's not extremely urgent right now, but I would sure like to have full functionality at some point.Thanks,-Patrick |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.