|
-
Apr 25th, 2020, 11:27 AM
#11
Re: Qustion 046: How to make RC5.WebServer only process the data of its own window?
 Originally Posted by dreammanor
Qustion 046: How to make RC5.WebServer only process the data of its own window?
Both RC5.WebServer in Form1 and Form2 are listening on "127.0.0.1: 8282", how to make ws_ProcessRequest in Form1 only handle DoSomething_01, and ws_ProcessRequest in Form2 only handle DoSomething_02?
Or, is it possible to simulate the use of Web-APIs to process the data in Form1 and Form2 separately? Thanks!
Form1
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_01
End Sub
Form2
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_02
End Sub
Note:
Form1 and Form2 may be loaded sequentially or simultaneously.
Either make the separate ws-instances (which are currently "per Form") listen on different Ports,
or just wrap the ws - Object in a separate Class (e.g. cSharedServer)...
From within cSharedServer you could then delegate to (Public Boolean-returning Functions in) as many Form-Instances as you like.
e.g. (ws_event-handler within cSharedServer):
Code:
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
If Form1.HandleRequest(Request) Then Exit Sub
If Form2.HandleRequest(Request) Then Exit Sub
'... a.s.o.
End Sub
HTH
Olaf
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|