Is there any way we can create the apps as a server and client in the same time ? such as socket.io wrapper?
Is there any way we can create the apps as a serve
Is there any way we can create the apps as a serve
|
Nov 7 2018, 04:19 PM, updated 6y ago
Show posts by this member only | Post
#1
|
Newbie
7 posts Joined: Nov 2018 |
Is there any way we can create the apps as a server and client in the same time ? such as socket.io wrapper?
|
|
|
|
Nov 7 2018, 09:57 PM
Show posts by this member only | Post
#2
|
Senior Member
2,096 posts Joined: Dec 2011 |
the answer is definitely a yes, but whether its a good idea or not depends on the exact implementation, which in turn depends on what exactly you're trying to do
|
|
Nov 13 2018, 03:12 PM
Show posts by this member only | Post
#3
|
Junior Member
632 posts Joined: Mar 2013 |
open a socket and listen to a port and you have a "server"
open a connection and connect to someone's port and you have a "client" you cannot do both of this on one thread and need different threads. this means as long as the platform you are running on supports multi threading then you can have both server and client as one app how feasible it would be is a different discussion all together |
|
Nov 22 2018, 01:52 PM
Show posts by this member only | Post
#4
|
Newbie
7 posts Joined: Nov 2018 |
QUOTE(bumpo @ Nov 13 2018, 03:12 PM) open a socket and listen to a port and you have a "server" Thanks for the reply. open a connection and connect to someone's port and you have a "client" you cannot do both of this on one thread and need different threads. this means as long as the platform you are running on supports multi threading then you can have both server and client as one app how feasible it would be is a different discussion all together |
|
Dec 11 2018, 06:46 PM
Show posts by this member only | Post
#5
|
Senior Member
1,018 posts Joined: Jul 2012 |
QUOTE(bumpo @ Nov 13 2018, 03:12 PM) open a socket and listen to a port and you have a "server" Don't HTTP/2 or websocket allows bidirectional communication? I reckon it should be possible to do it in a single thread. open a connection and connect to someone's port and you have a "client" you cannot do both of this on one thread and need different threads. this means as long as the platform you are running on supports multi threading then you can have both server and client as one app how feasible it would be is a different discussion all together |
|
Dec 11 2018, 08:09 PM
Show posts by this member only | Post
#6
|
Junior Member
632 posts Joined: Mar 2013 |
QUOTE(Lord Tiki Mick @ Dec 11 2018, 06:46 PM) Don't HTTP/2 or websocket allows bidirectional communication? I reckon it should be possible to do it in a single thread. Not too familiar with http2 but even if the connection can be reused to send/recv but listner and sending would need different thread no? Kinda like a main thread that spawns additional thread to handle send/recv. But yea, would be interesting to see if can be packed into just 1 thread. You up to the challenge? |
|
Dec 12 2018, 02:53 AM
Show posts by this member only | Post
#7
|
Senior Member
1,018 posts Joined: Jul 2012 |
QUOTE(bumpo @ Dec 11 2018, 08:09 PM) Not too familiar with http2 but even if the connection can be reused to send/recv but listner and sending would need different thread no? Kinda like a main thread that spawns additional thread to handle send/recv. It definitely can be done! Provided that it's sequencial, or using coroutine and a protocol needs to be defined so that either side of the communication knows when to send or recv.But yea, would be interesting to see if can be packed into just 1 thread. You up to the challenge? |
|
Dec 12 2018, 02:58 AM
Show posts by this member only | Post
#8
|
Junior Member
124 posts Joined: Oct 2012 From: Cosmopolitan |
|
|
Dec 18 2018, 07:30 AM
Show posts by this member only | Post
#9
|
Junior Member
632 posts Joined: Mar 2013 |
|
Change to: | 0.0144sec
0.49
5 queries
GZIP Disabled
Time is now: 29th March 2024 - 02:27 PM |