listen data (simple chat like)

rated by 0 users
This post has 0 Replies | 1 Follower

Not Ranked
Posts 2
zwan Posted: 04-24-2012 7:21 AM

hello i need a server listening to a port and clients sending data to this port(then server reply).

i have this function i think it is a good start:

 

function listen-port ($port) {
$endpoint = new-object System.Net.IPEndPoint ([ipaddress]::any,
$port)
$listener = new-object System.Net.Sockets.TcpListener $ep
$listener.start()
$listener.AcceptTcpClient() # will block here until connection
$listener.stop()
}

 

now i just need the client send a computer name "Mucomputer"

then the server will reply all user and machine info back.

 

can you help me with how to send receive data

and make thing asynchrone since server have to reply to a lot of query by day.

 

oops can you move this post the rigth category? ;)

Page 1 of 1 (1 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.