| | |
Server/Client Help
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2008
Posts: 2
Reputation:
Solved Threads: 0
Ok I have written some coding out for a server and Client in my Microsoft Visual C# 2008 but nothing seems to come up in the cmd.exe so i was wondering if anyone would know any reason why?
The cmd.exe opens but it is completly blank.
Here is my Coding incase someone wants to try it to see if it works for them:
This coding does look a bit strange here but its copied and pasted directly from my project
The cmd.exe opens but it is completly blank.
Here is my Coding incase someone wants to try it to see if it works for them:
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.NativeInterop; using System.Net.Sockets; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { WinsockClient Client = new WinsockClient(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Client.OnConnect += new SocketEventCallback<WinsockClient, object>(Client_OnConnect); Client.OnDisconnect += new SocketEventCallback<WinsockClient, object>(Client_OnDisconnect); Client.OnReceive += new SocketEventCallback<WinsockClient, byte[]>(Client_OnReceive); WinsockServer Server = new WinsockServer(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp); Server.OnClientConnect += new SocketEventCallback<CustomWinsockClient,object>(Server_OnClientConnect); Server.OnClientDisconnect += new SocketEventCallback<CustomWinsockClient,object>(Server_OnClientDisconnect); Server.OnClientReceive += new SocketEventCallback<CustomWinsockClient,byte[]>(Server_OnClientReceive); Server.Enable(9958, 10, 255); byte[] ClientRecvBuffer = new byte[255]; Client.Enable("82.15.228.51", 9958, ClientRecvBuffer); while (true) Console.ReadLine(); } static void Server_OnClientReceive(CustomWinsockClient Sender, byte[] Arg) { Console.WriteLine("Server: Received Message!"); Console.WriteLine("\t >>" + Encoding.ASCII.GetString(Arg)); } static void Server_OnClientDisconnect(CustomWinsockClient Sender, object Arg) { Console.WriteLine("Server: We Lost Connection To A Client!"); } static void Server_OnClientConnect(CustomWinsockClient Sender, object Arg) { Console.WriteLine("Server: We Got A Client"); Sender.Send(Encoding.ASCII.GetBytes("Greeting!")); } static void Client_OnReceive(WinsockClient Sender, byte[] Arg) { Console.WriteLine("Client: Recieved Message!"); Console.WriteLine("\t >> " + Encoding.ASCII.GetString(Arg)); Sender.Send(Encoding.ASCII.GetBytes("Hello, How Are You?")); Sender.Disconnect(); } static void Client_OnDisconnect(WinsockClient Sender, object Arg) { Console.WriteLine("Client: We Lost Connection!"); } static void Client_OnConnect(WinsockClient Sender, object Arg) { Console.WriteLine("Client: We're Connected To our Host"); } } }
![]() |
Similar Threads
- looking for server client example or help delphi (Pascal and Delphi)
- help for Server Client Porgram (chat Server) (Visual Basic 4 / 5 / 6)
- Server/client (C++)
- how to obtain the date and time of server from client by vb coding (Visual Basic 4 / 5 / 6)
- Server/Client timeout error (C)
- Connecting to web server using client desktop application (Visual Basic 4 / 5 / 6)
- Help with game server, client (VB.NET)
- What is server and client side code? (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: save all task
- Next Thread: C# and VBA problem....
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development draganddrop drawing encryption enum event excel file filename finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile gis globalization gtk httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser windows winforms wpf xml





