Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
QuestionPossible to send serialized objects from a TextWriter to a StreamReader? Pin
arnold_w13-May-09 21:45
arnold_w13-May-09 21:45 
AnswerRe: Possible to send serialized objects from a TextWriter to a StreamReader? Pin
Dave Kreskowiak14-May-09 3:51
mveDave Kreskowiak14-May-09 3:51 
GeneralRe: Possible to send serialized objects from a TextWriter to a StreamReader? Pin
arnold_w15-May-09 0:38
arnold_w15-May-09 0:38 
QuestionHelp about send file via blutooth Pin
sajjad.aghapouer13-May-09 21:43
sajjad.aghapouer13-May-09 21:43 
AnswerRe: Help about send file via blutooth Pin
Mycroft Holmes13-May-09 21:50
professionalMycroft Holmes13-May-09 21:50 
GeneralRe: Help about send file via blutooth Pin
sajjad.aghapouer14-May-09 7:09
sajjad.aghapouer14-May-09 7:09 
QuestionCards Anyone? Pin
IceWater4213-May-09 21:37
IceWater4213-May-09 21:37 
QuestionC# TCP Authentication HELP!! Pin
Serpendiem13-May-09 21:16
Serpendiem13-May-09 21:16 
Hey guys,

So recently I made this simple TCP server. What I want it to do now is, when the employee enters the id, it will go to the server, check it see if it exists -- if not, it simply returns an error message in the console and doesn't load the form. Here is what I have now.

using System;
using System.Text;
using System.Net;
using System.Net.Sockets;

public class serv
{
    public static void Main()
    {
       int c = 1234;
        try
        {
            IPAddress ipAd = IPAddress.Parse("69.10.61.145"); //use local m/c IP address, and use the same in the client

            /* Initializes the Listener */
            TcpListener myList = new TcpListener(ipAd, 7575);

            /* Start Listeneting at the specified port */
            myList.Start();

            Console.WriteLine("Login Server is running.");
            Console.WriteLine("Connection :" + myList.LocalEndpoint);
            Console.WriteLine("Waiting for logins...");
            Console.WriteLine("================================");

            Socket s = myList.AcceptSocket();
            Console.WriteLine("Connection accepted from: " + s.RemoteEndPoint);

            byte[] b = new byte[100];
            int k = s.Receive(b);
            

            
            Console.WriteLine("Login Attempt Recieved from: " + s.RemoteEndPoint);
            for (int i = 0; i < k; i++)
                Console.Write(Convert.ToChar(b[i]));
            

            ASCIIEncoding asen = new ASCIIEncoding();
            

      
           


                s.Send(asen.GetBytes("Login is invalid." + s.RemoteEndPoint));
                Console.WriteLine("\nAccess Denied.");
                Console.ReadLine();
                return;
                /* clean up */
            }
         

        
        catch (Exception e)
        {
            Console.WriteLine("Error..... " + e.StackTrace);
            Console.ReadLine();
        }
    }

}



I have the client done, I'm willing to manually add the employee id's in there, I just need help with bytes to int's etc.

[X] 100% HTML
[ ] 100% PHP
[X] 2% C#

QuestionRegarding Contructors Pin
Rajdeep.NET is BACK13-May-09 20:34
Rajdeep.NET is BACK13-May-09 20:34 
AnswerRe: Regarding Contructors Pin
stancrm13-May-09 20:41
stancrm13-May-09 20:41 
GeneralRe: Regarding Contructors Pin
Rajdeep.NET is BACK13-May-09 20:47
Rajdeep.NET is BACK13-May-09 20:47 
GeneralRe: Regarding Contructors Pin
Samer Aburabie13-May-09 20:55
Samer Aburabie13-May-09 20:55 
AnswerRe: Regarding Contructors Pin
OriginalGriff13-May-09 23:14
mveOriginalGriff13-May-09 23:14 
GeneralRe: Regarding Contructors Pin
Luc Pattyn14-May-09 1:25
sitebuilderLuc Pattyn14-May-09 1:25 
GeneralRe: Regarding Contructors Pin
Nagy Vilmos14-May-09 1:28
professionalNagy Vilmos14-May-09 1:28 
AnswerRe: Regarding Contructors PinPopular
Pete O'Hanlon13-May-09 21:59
mvePete O'Hanlon13-May-09 21:59 
GeneralRe: Regarding Contructors Pin
Luc Pattyn14-May-09 1:27
sitebuilderLuc Pattyn14-May-09 1:27 
QuestionHelp me about thread Pin
nvphap13-May-09 19:57
nvphap13-May-09 19:57 
AnswerRe: Help me about thread Pin
Samer Aburabie13-May-09 20:19
Samer Aburabie13-May-09 20:19 
AnswerRe: Help me about thread Pin
Mycroft Holmes13-May-09 21:46
professionalMycroft Holmes13-May-09 21:46 
QuestionWindows address book Pin
ashish purwar13-May-09 19:56
ashish purwar13-May-09 19:56 
AnswerRe: Windows address book Pin
Rajdeep.NET is BACK13-May-09 20:40
Rajdeep.NET is BACK13-May-09 20:40 
GeneralRe: Windows address book Pin
ashish purwar13-May-09 21:01
ashish purwar13-May-09 21:01 
GeneralRe: Windows address book Pin
Rajdeep.NET is BACK13-May-09 21:16
Rajdeep.NET is BACK13-May-09 21:16 
GeneralRe: Windows address book Pin
Henry Minute13-May-09 23:51
Henry Minute13-May-09 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.