글

3월, 2013의 게시물 표시

C#, tray notify test

네이트온 메신저에서 메시지가 온 경우 알림을 주는 것과 같이 알림을 주는 트레이알림 테스트 코드. 근데 이벤트 처리가 제대로 안된다 -_-;;; 다른 방식으로 처리를 해야하나,,,,,,,, 혹시 아는 분이 있으면 댓글을 달아주면 좋겠는데 label에 이벤트를 추가했어야하는데,, 그걸 안했었네 -_- 이제는 잘 되지만 정리된 코드는 아니라는 거. /*********************************************************** * *     C# notify window at tray test code_revision *     notifyWindowTest.cs  * ************************************************************/ using System; using System.Windows.Forms; using System.Threading; using System.Drawing; namespace notifyWindowTest {     class TrayNotifyWindow     {         Form nForm = new Form();         Label notiLabel;         int mywidth;         int myheight;         Thread t1;         public static ManualResetEvent allDone = new ManualResetEvent(false);         public TrayNotifyWin...

C strtok test

strtok 함수는 파싱할때 사용하기 좋은 함수이다. delimiter를 정하면 token 단위로 파싱 할 수 있다. 아래는 함수 테스트를 위한 코드 -------------------------------------------------------- /********************************************************** * *        Test code for testing strtok * ***********************************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #define CR \r #define LF \n #define SHOWALL 0 //#define REGISTER 0 //#define INVITE 1 #define IS_INVITE(val) strcmp(val,"INVITE") == 0 #define IS_CALLID(val) strcmp(val,"Call-ID") == 0 || strcmp(val, "CALL-ID") == 0 || strcmp(val, "call-id") == 0 #define IS_FROM(val) strcmp(val,"From") == 0 || strcmp(val,"FROM") == 0 #define IS_TO(val) strcmp(val,"To") == 0 || strcmp(val,"TO") == 0 enum SIP_METHOD{ REGISTER, INVITE, ACK, CANCEL, BYE, OPTIONS }; int sipd_parser(char *a_msg); i...

[link only] Installing Freepbx 2.8 with Asterisk 1.8 on Cent 5.8

Freepbx 2.8 [Src : http://www.markinthedark.nl/news/ubuntu-linux-unix/69-installing-freepbx-28-with-asterisk-18-on-centos-55.html] TLS [Src : http://www.freepbx.org/forum/freepbx/general-help/securing-the-conversation-with-tls-and-srtp-not-so-fast] [Src : https://wiki.asterisk.org/wiki/display/AST/Secure+Calling+Tutorial]

multi-platform TCP, UDP client socket

/*************************************************** * *  TCP Client_multi-platform * ****************************************************/ #ifdef WIN32 #ifndef _WINSOCKAPI_ #define _WINSOCKAPI_ #endif #endif #include <stdio.h> #ifdef WIN32 #pragma comment(lib, "ws2_32.lib") // Winsock 라이브러리 자동 링크 #include <windows.h> #include <winsock2.h> #define NET_INVALID_SOCKET INVALID_SOCKET #define NET_SOCKET_ERROR SOCKET_ERROR typedef int socklen_t; // unix 타입은 unsigned int, Windows는 int #else #include <sys/socket.h> // for socket(), bind(), connet() #include <arpa/inet.h> // for sockaddr_in, inet_ntoa() #include <unistd.h> // for close() #include <stdlib.h> // for exit() typedef int SOCKET; #define NET_INVALID_SOCKET -1 #define NET_SOCKET_ERROR -1 #endif #define MAX_DATA_SIZE 100 int main(){ #ifdef WIN32 WSADATA wsaData; WORD v...