TCP and C# Connecting via Lan

Have you ever thought that you want to connect to create an application that can talk via LAN? Then TCP is one of the mode that you can choose one. Here are the codes from MSDN that can help you:

TCPListen – This is used when you want to create a server like application.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace TCPListen
{
class Program
{
static void Main(string[] args)
{
TcpListener server = null;
try
{
// Set the TcpListener on port 13000.
Int32 port = 13000;
IPAddress localAddr = IPAddress.Parse("127.0.0.1");

// TcpListener server = new TcpListener(port);
server = new TcpListener(localAddr, port);

// Start listening for client requests.
server.Start();

// Buffer for reading data
Byte[] bytes = new Byte[256];
String data = null;

// Enter the listening loop.
while (true)
{
Console.Write("Waiting for a connection... ");

// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
TcpClient client = server.AcceptTcpClient();
Console.WriteLine("Connected!");

data = null;

// Get a stream object for reading and writing
NetworkStream stream = client.GetStream();

int i;

// Loop to receive all the data sent by the client.
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
// Translate data bytes to a ASCII string.
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
Console.WriteLine("Received: {0}", data);

// Process the data sent by the client.
data = data.ToUpper();

byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);

// Send back a response.
stream.Write(msg, 0, msg.Length);
Console.WriteLine("Sent: {0}", data);
}

// Shutdown and end connection
client.Close();
}
}
catch (SocketException e)
{
Console.WriteLine("SocketException: {0}", e);
}
finally
{
// Stop listening for new clients.
server.Stop();
}

Console.WriteLine("\nHit enter to continue...");
Console.Read();
}
}
}

TCPClient – As the name suggest it will be used to create the client that will connect to our server.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace TCPListen
{
class Program
{
static void Main(string[] args)
{
TcpListener server = null;
try
{
// Set the TcpListener on port 13000.
Int32 port = 13000;
IPAddress localAddr = IPAddress.Parse("127.0.0.1");

// TcpListener server = new TcpListener(port);
server = new TcpListener(localAddr, port);

// Start listening for client requests.
server.Start();

// Buffer for reading data
Byte[] bytes = new Byte[256];
String data = null;

// Enter the listening loop.
while (true)
{
Console.Write("Waiting for a connection... ");

// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
TcpClient client = server.AcceptTcpClient();
Console.WriteLine("Connected!");

data = null;

// Get a stream object for reading and writing
NetworkStream stream = client.GetStream();

int i;

// Loop to receive all the data sent by the client.
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
// Translate data bytes to a ASCII string.
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
Console.WriteLine("Received: {0}", data);

// Process the data sent by the client.
data = data.ToUpper();

byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);

// Send back a response.
stream.Write(msg, 0, msg.Length);
Console.WriteLine("Sent: {0}", data);
}

// Shutdown and end connection
client.Close();
}
}
catch (SocketException e)
{
Console.WriteLine("SocketException: {0}", e);
}
finally
{
// Stop listening for new clients.
server.Stop();
}

Console.WriteLine("\nHit enter to continue...");
Console.Read();
}
}
}

God Bless!

Thanks,
Thomie

Opencast, Your Free and Open Video Casting!

Hi There,

We are glad to invite you to our first Free service product, OpenCast. OpenCast is an online broadcasting websites that aim to help people broadcast freely and openly. The website is created using ASP.Net MVC, Entity Framework, SignalR, & OpenTok.

 

Feel Free to register now at http://opencast.info

God Bless!

Thanks,
Thomie

Get your Location Height

Have you ever wonder how can you get your location height above sea level? We’ll I have been one of those who wonders. Having the knowledge on how high your location is have advantages. One of the most common advantages is the probability of having a flood on your area. So I’ve search the net and found this website. http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm

You just need to find your location using the embeded google map and click. And you will get the height on feet. Thats easy.

Try it now!

 

Auto SMS Sender, finally found the best for me.

I have been searching for a perfect Auto SMS Sending application that will fit my very need.

Basic Needs

  • Send SMS Regularly
  • Sent Notification
  • Wide Selection of Intervals
  • Auto Response

Added Features

  • Calendar Notification
  • Backup of Created Scheduled SMS and even SMS in localdisk and Dropbox
  • Auto Forward

 

Therefore, if your looking for such app I will be recommending Auto SMS Sender by DRC InfoTech. Its free but with adds. The adds may annoy some of you but thinking of the features that it offers, I’ll say that its worthit.

What would they call it if your using ASP?

In PHP they are calling coders differently:

Baker when they are using CakePHP. An

How about in ASP .Net? What would they call people who are using WebForms, MVC, or Other MS Products? Would they call MVCaretakers  if your using MVC because your taking carefully all the coding so that it is coded separately so that it can be easily tested via Unit Test?

How about you? What would they call it?

Binding SSL Cerificate to a Machine

Prequisites

  • SSL Certificate (For Testing this can be self-signed)
  • Administrator Rights
  • Command Prompt
  • IIS 7 or above

Instructions

  1. Open the Certificate details and find its ThumbPrint in IIS
  2. Identify the port and IP to which the certificate to be binded
  3. Open the Command Prompt with Administrator Rights
  4. Type in the following
    netsh http add sslcert ipport=<IPtoBind>:<PortToBind> appid={12345678-db90-4b66-8b01-88f7af2e36bf} certhash=<CertificateThumbPrint>
  5. Done
  6. To remove that binding just type the following
    netsh http delete sslcert ipport=<IPtoBinded>:<PortToBinded>

[VMWARE] Exception 0xc0000006 (disk error while paging) has occurred

Hi,

This error, Exception 0xc0000006 (disk error while paging) has occurred, occurred when some improper turning off of your VMWare. In order to fix this you will need to delete the Suspended Session you need to delete or rename the *.vmss file – this is the virtual equivalent of a power-outage in a real machine.

via Source

Thanks,

Thomie

[MSSQL] Truncate all Table

Truncating all tables is not easy by default on MSSQL so I have search the net and found one. Just open up a new query and use the following codes:

Use databaseName
GO

EXEC sp_MSForEachTable ‘TRUNCATE TABLE ?’
GO

It will truncate all the tables under the databaseName DB.

God Bless!

Thanks,
Thomie

I Can Only Image – Mercy Me

httpv://www.youtube.com/watch?v=0xwzItqYmII

I Can Only Image – Mercy Me

c/o http://www.elyricsworld.com/i_can_only_imagine_lyrics_mercy_me.html

What it will be like 
When I walk 
By your side 

I can only imagine 
What my eyes will see 
When your face 

Is before me 
I can only imagine 

[Chorus:]
Surrounded by Your glory, what will my heart feel 
Will I dance for you Jesus or in awe of you be still 
Will I stand in your presence or to my knees will I fall 
Will I sing hallelujah, will I be able to speak at all 

I can only imagine 
I can only imagine 
When that day comes 

And I find myself 
Standing in the Son 

I can only imagine 
When all I will do 
Is forever 
Forever worship You 

I can only imagine

[Chorus]

I can only imagine [x2]

I can only imagine
When all I will do 
Is forever, forever worship you

Regular Expression Online Tool

Regular Expression Online Tool

Do you have some regular expression that you want to test online? Then this online tool is for you,

First you will fill up the regular expression and then you will be given two textbox to test it. Thats it.

 

Regular Expression Online Tool

Regular Expression Online Tool

 

Regular Expression Online Tool Link : http://tools.netshiftmedia.com/regexlibrary/

Who am I – Casting Crowns

httpv://www.youtube.com/watch?v=cjhxOv9YDag

Who Am I

c/o https://castingcrowns.com/node/643

Who am I, that the Lord of all the earth
Would care to know my name
Would care to feel my hurt?
Who am I, that the bright and morning star
Would choose to light the way
For my ever wondering heart?

Not because of who I am
But because of what You’ve done
Not because of what I’ve done
But because of who You are

I am a flower quickly fading
Here today and gone tomorrow
A wave tossed in the ocean
A vapor in the wind
Still You hear me when I’m calling
Lord You catch me when I’m falling
And You told me who I am
I am Yours, I am Yours

Who am I, that the eyes that see our sin
Would look on me with love
And watch me rise again?
Who am I, that the voice that calmed the sea
Would call out through the rain
And calm the storm in me?

Not because of who I am

But because what of You’ve done
Not because of what I’ve done
But because of who You are

I am a flower quickly fading
Here today and gone tomorrow
A wave tossed in the ocean
A vapor in the wind
Still You hear me when I’m calling
Lord You catch me when I’m falling
And You told me who I am
I am Yours

Not because of who I am
But because of what You’ve done
Not because of what I’ve done
But because of who You are

I am a flower quickly fading
Here today and gone tomorrow
A wave tossed in the ocean
A vapor in the wind
Still You hear me when I’m calling
Lord You catch me when I’m falling
You told me who I am
I am Yours, I am Yours, I am Yours

Whom shall I fear?
Whom shall I fear?
‘Cause I am Yours, I am Yours

jQuery: FullCalendar

Name: FullCalendar

Description: Most users find developing their own calendar UI not that quite easy but with jQuery FullCalendar you make it easy and fast!

 

Some of Specifications:

Demo: http://arshaw.com/fullcalendar/

Download: http://arshaw.com/fullcalendar/download/

Owl City – In Christ Alone

Owl City – In Christ Alone Lyrics
c/o http://www.elyricsworld.com/in_christ_alone_lyrics_owl_city.html

In Christ alone, my hope is found

He is my light, my strength, my song

This cornerstone, this solid ground

Firm through the fiercest drought and storm

What heights of love, what depths of peace

When fears are stilled, when strivings cease

My comforter, my all-in-all

Here in the love of Christ I stand

There in the ground His body lay

Light of the world by darkness slain

Then bursting forth in glorious day

Up from the grave He rose again
And as He stands in victory

Sin’s curse has lost its grip on me

For I am His and He is mine

Bought with the precious blood of Christ

No guilt in life, no fear in death

This is the power of Christ in me

From life’s first cry to final breath

Jesus commands my destiny

No power of hell, no scheme of man

Can ever pluck me from His hand

Till He returns or calls me home

Here in the power of Christ I’ll stand
Till He returns or calls me home

Here in the power of Christ I’ll stand
Here in the power of Christ I’ll stand 


Firefox OS Simulator : A glance

Hi There,

Its bean a very wonderful experience on how to have a simulator just in front of your Browser. You hear it right. The simulator of Firefox OS is on Firefox Browser Itself. No hassle. Just It.

Download it: http://people.mozilla.org/~myk/r2d2b2g/

Other Notes: https://hacks.mozilla.org/2012/11/announcing-the-prototype-firefox-os-simulator/