window Appliction using c#.net
-
How To send a value in port sivaramireddy(singarayakonda,prakasam)
-
How To send a value in port sivaramireddy(singarayakonda,prakasam)
You mean send a value to a port? Through a port? What kind of port? Port as in the drink? Port as in left? Port as in the kind of place where things go in and out of a country?
My current favourite word is: PIE! Good ol' pie, it's been a while.
-
You mean send a value to a port? Through a port? What kind of port? Port as in the drink? Port as in left? Port as in the kind of place where things go in and out of a country?
My current favourite word is: PIE! Good ol' pie, it's been a while.
how to send a value in remote server using tcp port or socket programming
-
how to send a value in remote server using tcp port or socket programming
Well, you make a connection to the other machine by use of IP and port number. For example, on the server side you could wait for a connection, and then send out some data:
//Listen for connection
TcpListener listener = new TcpListener(IPAddress.Any, 1234);//get socket from incomming connection
Socket mySocket = listener.AcceptSocket();//Send the number 5
byte[] data = {0x5};
mySocket.Send(data);And the client side would make a connection, and then wait for some data:
//Make a socket
Socket mySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//Connect to the server (assuming IP address to be 192.168.1.1)
mySocket.Connect(IPAdress.Parse("192.168.1.1"), 1234);//Set up the buffer
byte[] buffer = new byte[1024];
//receive some data
int dataLength = mySocket.Receive(buffer);//and then you can read the buffer to see what data you just received.
//dataLength will tell you how many bytes you received, so in this case, it would be 1.You can of course use the mighty powers of google to find what your looking for, or type 'socket' into the search bar up there.
My current favourite word is: PIE! Good ol' pie, it's been a while.