NAS Problem
sabato
Member Posts: 15
Hello,
well, I got some Problems with NAS. I try to connect from a PHP Site to the open Navision Socket.
This is the code on my php site:
And my Codeunit in Navision has the Following code:
Now the first Problem is, I can connect to the Socket, but after that I get a Timeout:
Connected
Fatal error: Maximum execution time of 30 seconds exceeded in \inetpub\wwwroot\sma\fsocket.php on line 24
And the other thing is, how can I get the NAS to Reply the right answer and how can I e.g. enter data into the db throug a php site.
Hope some of you guys can help me. i don't know to much about NAS. Just startet it yesterday.
well, I got some Problems with NAS. I try to connect from a PHP Site to the open Navision Socket.
This is the code on my php site:
<?php
$cfgServer = "10.100.4.98";
$cfgPort = 8085;
$cfgTimeOut = 300;
$txt = "Hello World";
$errno = 0;
$errstr = 0;
// open a socket
if(!$cfgTimeOut)
// without timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
// with timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
if(!$usenet_handle) {
echo "Connexion failed\n";
exit();
}
else {
echo "Connected\n";
$tmp = fgets($usenet_handle, 1024);
//fputs($usenet_handle, "$txt");
fclose ($usenet_handle);
}
?>
And my Codeunit in Navision has the Following code:
OnRun()
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
CC2.AddBusAdapter(SBA, 0);
//Timeout setzten
SBA.ReceivingTimeout:= 20000;
SBA.OpenSocket(8085, '');
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
//Nachricht abnehmen
InMsg:= InMessage;
//In einen InStream schreiben
InS:= InMsg.GetStream();
//Antwortnachricht erzeugen
OutMsg:= InMsg.CreateReply;
//In einen OutStream schreiben
OutS:= OutMsg.GetStream();
//Eingegangene Nachricht in die Ausgangsnachricht kopieren
COPYSTREAM(OutS,InS);
//Anwortnachricht versenden
OutMsg.Send(0);
InMsg.CommitMessage();
Now the first Problem is, I can connect to the Socket, but after that I get a Timeout:
Connected
Fatal error: Maximum execution time of 30 seconds exceeded in \inetpub\wwwroot\sma\fsocket.php on line 24
And the other thing is, how can I get the NAS to Reply the right answer and how can I e.g. enter data into the db throug a php site.
Hope some of you guys can help me. i don't know to much about NAS. Just startet it yesterday.
0
Comments
-
Answer to the first problem from php.net help:
Your script can also be terminated by the built-in script timer. The default timeout is 30 seconds. It can be changed using the max_execution_time php.ini directive or the corresponding "php_value max_execution_time" Apache .conf directive as well as with the set_time_limit() function. When the timer expires the script will be aborted0 -
Thanks for that, but I already figured that out

Greetings
sabato0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions