Commit b8868eede46e463d50daaf9eac4b83e5953d1547
1 parent
df34c770
Exists in
master
Connect do PHP não estava esperando tempo suficiente, parâmetro wait foi mudado …
…para indicar o número de segundos a esperar por uma conexão.
Showing
2 changed files
with
24 additions
and
3 deletions
Show diff stats
src/misc.cc
@@ -39,11 +39,11 @@ PHP_METHOD(tn3270, connect) | @@ -39,11 +39,11 @@ PHP_METHOD(tn3270, connect) | ||
39 | { | 39 | { |
40 | const char * host; | 40 | const char * host; |
41 | int szHost; | 41 | int szHost; |
42 | - zend_bool wait = 0; | 42 | + long wait; |
43 | int rc = 0; | 43 | int rc = 0; |
44 | tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC); | 44 | tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC); |
45 | 45 | ||
46 | - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &host, &szHost, &wait) == FAILURE) | 46 | + if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &szHost, &wait) == FAILURE) |
47 | RETURN_NULL(); | 47 | RETURN_NULL(); |
48 | 48 | ||
49 | if(szHost) | 49 | if(szHost) |
@@ -51,7 +51,7 @@ PHP_METHOD(tn3270, connect) | @@ -51,7 +51,7 @@ PHP_METHOD(tn3270, connect) | ||
51 | char text[szHost+1]; | 51 | char text[szHost+1]; |
52 | strncpy(text,host,szHost); | 52 | strncpy(text,host,szHost); |
53 | text[szHost] = 0; | 53 | text[szHost] = 0; |
54 | - rc = obj->hSession->connect(text,wait); | 54 | + rc = obj->hSession->connect(text,(int) wait); |
55 | } | 55 | } |
56 | else | 56 | else |
57 | { | 57 | { |
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | + printf("PW3270 Connection test\n"); | ||
4 | + | ||
5 | + $host = new tn3270(""); | ||
6 | + | ||
7 | + $rc = $host->connect("tn3270://fandezhi.efglobe.com:23",10); | ||
8 | + if($rc != 0) { | ||
9 | + die("Connection failed, rc=" . $rc . "\n"); | ||
10 | + } | ||
11 | + | ||
12 | + $rc = $host->waitforready(10); | ||
13 | + if($rc != 0) { | ||
14 | + die("Host is not ready, rc=" . $rc . "\n"); | ||
15 | + } | ||
16 | + | ||
17 | + $host->disconnect(); | ||
18 | + | ||
19 | + die("Success!!\n"); | ||
20 | + | ||
21 | +?> |