SockCli and SockServer sample using is not clear for me

SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Wed Sep 20, 2017 2:47 pm

Hey,

Looking into those 2 samples, I was thinking of finding a solution for my problem.

I have a 3' party modules that reads from Lan on IP 192.168.1.101 on port 33334. (it is a Panasonic Phone system NCP500)
That program only writes a log.dat file with the phone number into it.

Now I capture that log file, lookup into dbf, and popup a Screen. Works OK.

I want to find the full string of data, that the PBX is sending over the lan by reading the port and IP

My Question :

Is the PBX not working as a server ? and do I only need to focus on the SockCli.prg sample to find a solution or do I also need the SockServ program to work.
I don't think so, but I could be wrong.

I don't want to go back to TAPI and Serial ports since Lan can be working.

Any suggestions, samples?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: SockCli and SockServer sample using is not clear for me

Postby MarcoBoschi » Wed Sep 20, 2017 3:52 pm

Is the PBX not working as a server ?
No in my opinion PBX is working as *the client* you have to take a look at sockserv.prg
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: SockCli and SockServer sample using is not clear for me

Postby MarcoBoschi » Wed Sep 20, 2017 4:00 pm

Mark,
I use innovaphone pbxs

Image

In the Pbx I set Ip address and port of Pc in which there is a program (like sockserv.prg) thas is waiting for information
In this case pbx sends all cdr informations
the program receives these informations and than write them into a dbf table
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Wed Sep 20, 2017 8:19 pm

Ok, So the PC is the server and the PBX is the client. Clear...

The client (PBX) is sending to one IP adress of the PC with a specifiek Port ; Clear ...

The SockServ.prg will call the Port, but does not need the IP adres, because he is the IP adres. ?? There is no reference in the sockserv.prg that has a val of the IP.

By meaning of test, I put the compiled client prg on my laptop (witch is also on that lan with WIFI)
and the server on my desktop. I don't see any communication working.

In the server I get even a error

Path and name: C:\fwh1705\samples\sockserv.exe (32 bits)
Size: 3,742,208 bytes
Compiler version: Harbour 3.2.0dev (r1506171039)
FiveWin version: FWH 17.05
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.1, Build 7601 Service Pack 1

Time from start: 0 hours 0 mins 1 secs
Error occurred at: 09/20/17, 22:18:08
Error description: Error BASE/1004 No exported method: SENDDATA
Args:
[ 1] = U
[ 2] = C Hello from server!

Stack Calls
===========
Called from: => SENDDATA( 0 )
Called from: sockserv.prg => (b)MAIN( 23 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 683 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 919 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1866 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1036 )
Called from: sockserv.prg => MAIN( 25 )

System

There is more going on I think ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: SockCli and SockServer sample using is not clear for me

Postby MarcoBoschi » Thu Sep 21, 2017 7:36 am

You are right when you click it goes wrong
But If you click the first button on the left of sockserv.exe
And then from your phone you "send" data you sholud see something
Maybe you have to test sockserv it using sockli.prg first
disable firewall first of all
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Thu Sep 21, 2017 7:44 am

OK. WIll try.

The Firewall will be the trouble I think. Will look into it.

For testing Serv - Client (Prg's)

It is the IP4 IP from the computer that I put the sockserv on that is the correct one. Does the port nummer matter in this case, or can I use the proposed 2000
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: SockCli and SockServer sample using is not clear for me

Postby MarcoBoschi » Thu Sep 21, 2017 8:05 am

2000!
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Thu Sep 21, 2017 3:16 pm

I think that I don't access the right IP from the serv. program ?

Pbx = 192.168.1.101 and port = 33334

It it accessed by a 3 party proggie from My computer, where I try to get sockserv running. I can show some data from the Pbx.

My Pc says in IpConfig :

IP4 = 192.168.1.104

So my sockserv program is running on the IP xxx.104 and not accessing the xxx.101 I think.

If I also put oSocket:Connect( "192.168.1.101" ) in the serv. program, I'ts not working.


Code: Select all  Expand view  RUN
function Server()

   oSocket = TSocket():New( 33334 )

   oSocket:bAccept = { | oSocket | oClient := TSocket():Accept( oSocket:nSocket ),;
                       oClient:Cargo := ST_COMMAND,;
                       oClient:bRead := { | oSocket | OnRead( oSocket ) },;
                       oClient:bClose := { | oSocket | OnClose( oSocket ) } }

   oSocket:Connect( "192.168.1.101" ) // I only put this here once to try, but it also does not work
   oSocket:Listen()

return nil
 


I'm still missing the point )))
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: SockCli and SockServer sample using is not clear for me

Postby MarcoBoschi » Fri Sep 22, 2017 8:11 am

first of all try running both programs sockli.exe and sockli on the same pc
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Fri Sep 22, 2017 9:08 am

Togetter they work OK. I see the log file created.

I have to read more about Ip's...

The server program has No parameter for the IP.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: SockCli and SockServer sample using is not clear for me

Postby Marc Venken » Fri Sep 22, 2017 10:23 am

I changed the IP (default seems to be (Gethostbyname)

Code: Select all  Expand view  RUN
function Server()

   oSocket = TSocket():New( 33334 )
   oSocket:cIPAddr  = "192.168.1.101"

   oSocket:bAccept = { | oSocket | oClient := TSocket():Accept( oSocket:nSocket ),;
                       oClient:Cargo := ST_COMMAND,;
                       oClient:bRead := { | oSocket | OnRead( oSocket ) },;
                       oClient:bClose := { | oSocket | OnClose( oSocket ) } }

   cIp := oSocket:cIPAddr
   msginfo(cIp)
   cPort := oSocket:nPort
   msginfo(cPort)


   oSocket:Listen()

return nil
 


Still no data.

Will puzzel a bit with Bitdefender. Program is set as allow, but also no data.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 46 guests